A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-March/087754.html below:

[Python-Dev] GPython?

[Python-Dev] GPython?Stefan Behnel stefan_ml at behnel.de
Fri Mar 27 07:12:37 CET 2009
Brett Cannon wrote:
> On Thu, Mar 26, 2009 at 18:05, Terry Reedy wrote:
>> If one adds type annotations so that values can be unboxed, would not
>> Cython, etc, do even better for speedup?
> 
> Nope as Unladen is planning to re-implement the eval loop, something Cython
> doesn't optimize without the need to suddenly start adding type annotations
> to code.

Sorry, but this is not correct.

When you let Cython compile a standard Python module, it will not use
Python's eval loop inside the module. It is only used by module external
code. And you can use "pyximport" to let Cython (try to) also compile
external modules on-the-import. This even works for a couple of stdlib
modules by now.

And you are not required to use type annotations to compile your code into
a faster C module. Cython is often faster than CPython by 10-30% even for
plain Python code. Plus, you can use function decorators for type
annotations to keep your code 100% Python (2.4) compatible, and you can put
a .pxd file with type annotations next to your .py module to provide the
type annotations externally. This can get you a speedup of factors, without
modifying your Python code at all.

Stefan

More information about the Python-Dev mailing list

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