public inbox for [email protected]
 help / color / mirror / Atom feed
From: Olivier Langlois <[email protected]>
To: Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>,
	 [email protected]
Subject: Re: [PATCH 0/2] abstract napi tracking strategy
Date: Thu, 15 Aug 2024 18:44:45 -0400	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On Thu, 2024-08-15 at 18:17 -0400, Olivier Langlois wrote:
> 
> To my eyes, what is really important, it is that absolute best
> technical solution is choosen and the only way that this discussion
> can
> be done, it is with numbers. So I have created a small created a
> small
> benchmark program to compare a function pointer indirect call vs
> selecting a function in a 3 branches if/else if/else block. Here are
> the results:
> 
> ----------------------------------------------------------
> Benchmark                Time             CPU   Iterations
> ----------------------------------------------------------
> BM_test_virtual      0.628 ns        0.627 ns    930255515
> BM_test_ifElse        1.59 ns         1.58 ns    446805050
> 
I have fixed my benchmark:

----------------------------------------------------------
Benchmark                Time             CPU   Iterations
----------------------------------------------------------
BM_test_virtual       2.57 ns         2.53 ns    277764970
BM_test_ifElse        1.58 ns         1.57 ns    445197861

code:
using Func_t = bool (*)();

bool testVirtual(Func_t ptr)
{
    return ptr();
}

void BM_test_virtual(benchmark::State &state)
{
    volatile Func_t ptr = &static_tracking_do_busy_loop;

    for (auto _ : state) {
        benchmark::DoNotOptimize(testVirtual(ptr));
    }
}


  reply	other threads:[~2024-08-15 22:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 16:44 [PATCH 0/2] abstract napi tracking strategy Olivier Langlois
2024-08-13 17:10 ` [PATCH 1/2] io_uring/napi: Introduce io_napi_tracking_ops Olivier Langlois
2024-08-14 11:44   ` Olivier Langlois
2024-08-14 13:17     ` Jens Axboe
2024-08-13 17:11 ` [PATCH 2/2] io_uring/napi: add static napi tracking strategy Olivier Langlois
2024-08-13 18:33 ` [PATCH 0/2] abstract " Jens Axboe
2024-08-13 21:25   ` Olivier Langlois
2024-08-13 21:44     ` Jens Axboe
2024-08-15 22:17       ` Olivier Langlois
2024-08-15 22:44         ` Olivier Langlois [this message]
2024-08-16 14:26           ` Pavel Begunkov
2024-09-16 18:29             ` Olivier Langlois
2024-08-13 22:36     ` Pavel Begunkov
2024-08-14 13:28       ` Pavel Begunkov
2024-08-13 21:34   ` Olivier Langlois
2024-08-13 21:45     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b13d089da46f091d66bbc8f96b1d4da881e53d1.camel@trillion01.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox