On 9 August 2016 at 23:26, Nick Coghlan <ncoghlan at gmail.com> wrote: > On 9 August 2016 at 06:18, Guido van Rossum <guido at python.org> wrote: > >> I think Nick would be interested in understanding why this is the case. >> What does the decorator do that could be so expensive? >> > > Reviewing https://hg.python.org/cpython/file/default/Lib/contextlib.py#l57, > Chris's analysis seems plausible to me > Sorry Wolfgang - I missed that Chris was expanding on a comparison you initially made! Either way, I agree that aspect does make up the bulk of the difference in speed, so moving to C likely wouldn't help much. However, the speed difference relative to the simpler warppers is far less defensible - I think there are some opportunities for improvement there, especially around moving introspection work out of _GeneratorContextManager.__init__ and into the contextmanager decorator itself. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160809/82173b1a/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4