On 9 August 2016 at 23:26, Nick Coghlan <ncogh...@gmail.com> wrote: > On 9 August 2016 at 06:18, Guido van Rossum <gu...@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 | ncogh...@gmail.com | Brisbane, Australia
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com