Re: [Python-Dev] Rewrite @contextlib.contextmanager in C
On 8/8/2016 22:38, Yury Selivanov wrote: On 2016-08-08 4:18 PM, Guido van Rossum wrote: I think Nick would be interested in understanding why this is the case. What does the decorator do that could be so expensive? From the looks of it it doesn't do anything special. Although with @contextlib.contextmanager we have to instantiate a generator (the decorated one) and advance it in __enter__. So it's an extra object instantiation + extra code in __enter__ and __exit__. Anyways, Nick knows much more about that code. Right, I think a fairer comparison would be to: class ctx2: def __enter__(self): self.it = iter(self) return next(self.it) def __exit__(self, *args): try: next(self.it) except StopIteration: pass def __iter__(self): yield With this change alone the slowdown diminishes to ~ 1.7x for me. The rest is probably the extra overhead for being able to pass exceptions raised inside the with block back into the generator and such. ___ 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
[Python-Dev] docs.python.org problem
Dear all, FYI, https://docs.python.org/3.6/ is currently pointing to the Python 3.7.0a0 documentation Best, Wolfgang ___ 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
Re: [Python-Dev] Benchmarks: Comparison between Python 2.7 and Python 3.6 performance
On 05.11.2016 10:56, Antoine Pitrou wrote: Hi Victor, On Fri, 4 Nov 2016 13:53:10 +0100 Victor Stinner wrote: Raw results of Python 3.6 compared to Python 2.7: That's interesting, but I would be personally more interested in a performance comparison of 3.5 and 3.6, to know if anything interesting (or worrying :-)) has happened there. You can get this as well from https://speed.python.org/comparison/ and https://speed.python.org/timeline and looking at this, I think there is something worrying indeed: Startup time has increased by ~ 30 % between 3.5 and 3.6 again. More specifically, all this increase happened between Sep 09 and Sep 15. I have no clue why that is, but it is definitely the biggest effect far and wide. The performance differences between 2.7 and 3.x are quite well-known by now, and none of them are really dramatic except for the increase in startup time. Regards Antoine. ___ 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