[issue18932] Optimize selectors.EpollSelector.modify()

2018-06-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: This was implemented in https://bugs.python.org/issue30014. Closing as duplicate. -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed versions: +Python 2.7 -Python 3.5 ___ Python t

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-16 Thread Charles-François Natali
Charles-François Natali added the comment: Does anyone have a realistic use case where modify() is actually a non-negligible part? -- ___ Python tracker ___ _

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-15 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Attached is a patch (for epoll only) which updates the SelectorKey. This introduces a considerable slowdown compared to my first patch: no patch:16.2 usec per loop your patch: 12.4 usec per loop my patch:10.9 usec per loop first patch: 3.07 usec per

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-15 Thread STINNER Victor
STINNER Victor added the comment: @Giampaolo: I'm not sure that I understood your proposition? Can you please write a patch? -- ___ Python tracker ___ __

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- stage: -> needs patch type: -> performance ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Yes, it appears so. I would suggest to come up with a patch which overrides modify() for all those selectors which can benefit from it (poll, epoll, kqueue) and refactor register() / unregister() (for select) in a separate issue / patch. Also, I suppose a c

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread STINNER Victor
STINNER Victor added the comment: 2015-02-05 18:46 GMT+01:00 Giampaolo Rodola' : > +def modify(self, fileobj, events, data=None): > +... > +if events != key.events: You should update the SelectorKey in the case, no? -- ___

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I mean something like this (for epoll), as in avoiding to call unregister() / register() at all: diff -r 017e7391ab58 Lib/selectors.py --- a/Lib/selectors.py Wed Feb 04 08:37:02 2015 -0800 +++ b/Lib/selectors.py Thu Feb 05 18:42:26 2015 +0100 @@ -412,6 +4

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread STINNER Victor
STINNER Victor added the comment: > - drop SelectSelector._modify(): calling unregister() + register() is just > fine I checked with strace: PollSelector.modify() doesn't require any syscall, so I propose to also drop it (to just call unregister + register). What do you think? I would like to

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-05 Thread STINNER Victor
STINNER Victor added the comment: Updated patch with a less surprising _modify() method: - the default implementation simply calls unregister() + register(), as before - drop SelectSelector._modify(): calling unregister() + register() is just fine -- Added file: http://bugs.python.org/fi

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor
STINNER Victor added the comment: Benchmark on Fedora 21 (Linux 3.18.3, glibc 2.20, Python 3.5 rev 7494f3972726). Original: haypo@selma$ ./python -m timeit -s 'import os, selectors; s=selectors.SelectSelector(); r,w=os.pipe(); s.register(r, selectors.EVENT_READ)' 's.modify(r, selectors.EVENT_

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread Charles-François Natali
Charles-François Natali added the comment: Well, I'd like to see at least one benchmark. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: _BaseSelectorImpl.modify() still calls unregister() and register(). To my understanding the whole point of this proposal was to avoid that in order to obtain the speedup and (possibly) avoid race conditions. -- _

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor
STINNER Victor added the comment: I tested SelectSelector, PollSelector, EpollSelector on Linux. I ran tests on FreeBSD, so also tested KqueueSelector. I didn't test DevpollSelector, but the code should be identical to PollSelector (the API is the same). -- ___

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor
STINNER Victor added the comment: Here is a patch: Issue #18932, selectors: Optimize the modify() method of selectors Optimize also register() and unregister() methods of KqueueSelector: only call kqueue.control() once. -- keywords: +patch Added file: http://bugs.python.org/file38014/

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-03 Thread STINNER Victor
Changes by STINNER Victor : -- components: +asyncio nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-03 Thread STINNER Victor
STINNER Victor added the comment: selectors.EpollSelector.modify() should use epoll.modify() instead of unregister()+register(). -- title: selectors and modify() -> Optimize selectors.EpollSelector.modify() ___ Python tracker