Nuitka now supports Python 3.2

S

Steven D'Aprano

Nuitka now supports Python 3.2 syntax and compiles the full CPython 3.2
test suite.

http://nuitka.net/posts/nuitka-release-040.html


What is Nuitka?

Nuitka is an implementation of Python written in C++. At the moment it is
claimed to be about 2.5 times as fast as CPython running the pystone
benchmark. Future plans including using type inference and whole program
analysis to optimize Python code using C++ native types.

Unlike PyPy, which is a JIT compiler, Nuitka is intended as a static
optimizing compiler.
 
A

Andriy Kornatskyy

Steven,

Just in case... pypy1.9 runs this test 22x faster than cpython2.7, see below.

python2.7 -c "from test import pystone;[pystone.main() for i in range(10)]"
Pystone(1.1) time for 50000 passes = 0.62
This machine benchmarks at 80645.2 pystones/second
....
Pystone(1.1) time for 50000 passes = 0.53
This machine benchmarks at 94339.6 pystones/second


pypy-1.9/bin/pypy -c "from test import pystone;[pystone.main() for i in range(10)]"

Pystone(1.1) time for 50000 passes = 0.116008
This machine benchmarks at 431005 pystones/second
....
Pystone(1.1) time for 50000 passes = 0.024002
This machine benchmarks at 2.08316e+06 pystones/second

Thanks.

Andriy Kornatskyy


----------------------------------------
 
J

jmfauth

--------

Fascinating software.
Some are building, some are destroying.

Py33[0.2573893570572636, 0.24261832285651508, 0.24259548003601594]

Py323
timeit.repeat("{1:'abc需'}")
[0.11000708521282831, 0.0994753634273593, 0.09901023634051853]

jmf
 
J

jmfauth

--------

Fascinating software.
Some are building, some are destroying.

Py33>>> timeit.repeat("{1:'abc需'}")

[0.2573893570572636, 0.24261832285651508, 0.24259548003601594]

Py323
timeit.repeat("{1:'abc需'}")
[0.11000708521282831, 0.0994753634273593, 0.09901023634051853]

jmf

----

Oops. My bad. (This google).

You should read abc需

jmf
 
M

Mark Lawrence

--------

Fascinating software.
Some are building, some are destroying.

Py33[0.2573893570572636, 0.24261832285651508, 0.24259548003601594]

Py323
timeit.repeat("{1:'abc需'}")
[0.11000708521282831, 0.0994753634273593, 0.09901023634051853]

jmf

Haven't I seen you at the airport throwing bread crumbs to the
helicoptors, as clearly that's just how stupid you are?
 
M

Michael Torrie

Nuitka now supports Python 3.2 syntax and compiles the full CPython 3.2
test suite.

Interestingly, GvR seemed to be quite critical of it in his comment at
the end of this post:
https://ep2013.europython.eu/conference/talks/nuitka-the-python-compiler

Not sure why. Nuitka is a very interesting little project. If nothing
else, it might be a good way of providing an executable bundle for a
python-based program, and a little speed-up is a bonus.

I find it pretty interesting that he can statically compile a dynamic
language.
 
S

Stefan Behnel

Steven D'Aprano, 26.02.2013 13:18:
Nuitka is an implementation of Python written in C++. At the moment it is
claimed to be about 2.5 times as fast as CPython running the pystone
benchmark.

Could we please get to the habit of not citing results of "benchmarks" that
*any* static analysis phase will just optimise away either completely or in
major parts? It's not surprising that an empty loop runs faster than one
that actually does something. And most real-world code avoids empty loops
rather deliberately.

Stefan
 
S

Steven D'Aprano

Steven D'Aprano, 26.02.2013 13:18:

Could we please get to the habit of not citing results of "benchmarks"
that *any* static analysis phase will just optimise away either
completely or in major parts?

Are you saying that the pystone benchmark contains such an empty loop?

Do you know for a fact that Nuitka performs such an optimization based on
static analysis?

Are you saying that this one test is so significant that it invalidates
the entire pystone benchmark?
 
S

Stefan Behnel

Steven D'Aprano, 28.02.2013 14:23:
Are you saying that the pystone benchmark contains such an empty loop?

Do you know for a fact that Nuitka performs such an optimization based on
static analysis?

Are you saying that this one test is so significant that it invalidates
the entire pystone benchmark?

Yes, this effect renders most of the "benchmark" (and of similar
"benchmarks") useless, and yes, Nuitka obviously does static analysis (it's
a static compiler), just like the C++ compiler that passes over the
generated code right afterwards. It's nothing special. In fact, CPython is
special in that it (deliberately) does not apply this kind of
optimisations. Everyone else does, not so much because it's required but
because it's so simple to do when you need static analysis anyway in order
to do whatever kind of static code translation. And any static compiler
needs to do static analysis, at least to some extent.

The problem with this kind of "benchmarks" is that they were written for
CPython and are entirely based on the assumption that the runtime does not
apply any optimisations. As soon as this assumption fails, the "benchmarks"
are no longer meaningful. Specifically, they are completely useless for
comparing different runtimes.

In Cython, we even deliberately do *not* implement several possible
optimisations because we know that they would only apply to bad
"benchmarks", not to real-world code, and would thus only bloat our
compiler code more than they would help anyone. It's important to find a
good balance between complexity and performance, and I actually find that
CPython has made a very reasonable choice here. Its implementation is
intentionally simple in many aspects (especially its VM), and less so in
others (e.g. data types).

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top