Author vstinner
Recipients serhiy.storchaka, vstinner, yselivanov
Date 2016-01-28.16:42:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453999368.37.0.283032319147.issue26233@psf.upfronthosting.co.za>
In-reply-to
Content
> Any benchmarks?

Wait, it's easier to write a patch than to cook a benchmark :-)

Attached script bench_epoll_poll.py creates a lot of sockets and call epoll.poll() in non-blocking mode (timeout=0). You can decide to create or not events.

It looks like performance when epoll.poll() gets events are unchanged with my patch.

The performance are better when epoll.poll() doesn't get any event: between 6% and 20% faster.

I'm not completly sure that it's worth it since we are talking about nanoseconds. The largest seen difference was 94 nanoseconds: 420 ns => 326 ns.

My microbenchmark is unstable. Even if it runs the benchmark 25 or 50 times and take the minimum, I have to run it between 3 and 10 times to see the "real" minimum timing... It's a common problem for microbenchmarks with timing smaller than 1 ms.


Create read+events (10 sockets):

*  Without the patch: Best of 25 runs (100000 loops, 10 FDs): 1294 ns per call to epoll.poll()
*  With the patch: Best of 50 runs (100000 loops, 10 FDs): 1221 ns (-6%) per call to epoll.poll()

Create read+events (8000 sockets):

*  Without the patch: Best of 25 runs (10 loops, 16000 FDs): 4.6 ms per call to epoll.poll()
*  With the patch: Best of 25 runs (10 loops, 16000 FDs): 4.6 ms (same) per call to epoll.poll()

Don't create events (10 sockets):

*  Without the patch: Best of 50 runs (100000 loops, 10 FDs): 367 ns per call to epoll.poll()
*  With the patch: Best of 50 runs (100000 loops, 10 FDs): 343 ns (-7%) per call to epoll.poll()

Don't create events (1000 sockets):

*  Without the patch: Best of 50 runs (100000 loops, 1000 FDs): 420 ns per call to epoll.poll()
*  With the patch: Best of 50 runs (100000 loops, 1000 FDs): 326 ns (-22%) per call to epoll.poll()

Don't create events (16000 sockets):

*  Without the patch: Best of 50 runs (100000 loops, 16000 FDs): 422 ns per call to epoll.poll()
*  With the patch: Best of 50 runs (100000 loops, 16000 FDs): 338 ns (-20%) per call to epoll.poll()
History
Date User Action Args
2016-01-28 16:42:48vstinnersetrecipients: + vstinner, serhiy.storchaka, yselivanov
2016-01-28 16:42:48vstinnersetmessageid: <1453999368.37.0.283032319147.issue26233@psf.upfronthosting.co.za>
2016-01-28 16:42:48vstinnerlinkissue26233 messages
2016-01-28 16:42:48vstinnercreate