[issue24325] Speedup types.coroutine()

Yury Selivanov report at bugs.python.org
Fri Jul 3 05:56:34 CEST 2015


Yury Selivanov added the comment:

> Oh, wait, I was confusing myself.  This is that new module you guys created for type hints, and this is a new object with no installed base.  (Right?)

No, you were right in your previous comment...

> Help me to understand here.  You want to check in a patch adding 300 new lines of C code to the types module during beta, for a speed optimization, after we've already hit beta?

> While I like speedups as much as the next guy, I would be happier if this waited for 3.6.

This speedup will mostly affect code compiled with Cython. See the following example:
  
  @asyncio.coroutine
  def coro():
     yield from ...

Cython will compile "coro" into a function, that returns a generator-like object.  "asyncio.coroutine" will wrap this function, and, therefore, the optimized by Cython generator-like object will be wrapped too (to provide an __await__ method).

This patch provides a faster wrapper for such generator-like objects. Since the whole point of using Cython is to squeeze as much performance as possible, I think it's essential to have this optimization in 3.5 (or at least in 3.5.1 as Guido suggested).

It's a lot of C code, I agree. I only can say that I did my best to write very extensive unittests, and so I hope that it won't cause any trouble.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24325>
_______________________________________


More information about the Python-bugs-list mailing list