Author neologix
Recipients neologix
Date 2013-01-06.03:30:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357443002.47.0.422738072867.issue16876@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-01-06 03:30:02neologixsetrecipients: + neologix
2013-01-06 03:30:02neologixsetmessageid: <1357443002.47.0.422738072867.issue16876@psf.upfronthosting.co.za>
2013-01-06 03:30:02neologixlinkissue16876 messages
2013-01-06 03:30:01neologixcreate