Message179167
Currently, epoll.poll() allocates an epoll_event buffer every time/ this is bad, because it changes an O(number of ready FDs) syscall into a O(maxevents/FD_SETSIZE) complexity.
The patch attached allocates a epoll events buffer per epoll instance, and it only gets reallocated when necessary (note that the reallocation heuristic will probably be improved in #16873 (and having a per instance maxevents count will likely be useful).
Here's a benchmark without patch:
$ ./python -m timeit -s 'import select; ep = select.epoll(); ep.register(1, select.EPOLLOUT)' 'ep.poll()'
100000 loops, best of 3: 4.25 usec per loop
With patch:
$ ./python -m timeit -s 'import select; ep = select.epoll(); ep.register(1, select.EPOLLOUT)' 'ep.poll()'
100000 loops, best of 3: 3.38 usec per loop |
|
Date |
User |
Action |
Args |
2013-01-06 03:30:02 | neologix | set | recipients:
+ neologix |
2013-01-06 03:30:02 | neologix | set | messageid: <1357443002.47.0.422738072867.issue16876@psf.upfronthosting.co.za> |
2013-01-06 03:30:02 | neologix | link | issue16876 messages |
2013-01-06 03:30:01 | neologix | create | |
|