Re: [Python-Dev] Rewrite @contextlib.contextmanager in C

2016年8月09日 06:40:28 -0700

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

Reply via email to