News for hackers. Stuff that matters.
Re:Nuitka: a Python compiler by vog on Thursday September 28, 2017 @05:03AM (#15355754)
How does this compare to PyPy in terms of speed and optimizations?
Re:Nuitka: a Python compiler by DonbunEf7 on Thursday September 28, 2017 @10:42AM (#15357429)
Compared to PyPy, Nuitka is slow, buggy, and doesn't handle as much of the Python language. Nuitka vomits and dies on about half the code I've tried it on.
Re:Nuitka: a Python compiler by hamilyon2 on Thursday September 28, 2017 @05:38AM (#15355882)
It is generally slower and much more predictable and regular
Re:Nuitka: a Python compiler by tsavola on Thursday September 28, 2017 @05:59AM (#15355949)
Which one?
Re:Nuitka: a Python compiler by chrisseaton on Thursday September 28, 2017 @06:08AM (#15355975)
I would imagine Nuitka is slower, because it cannot apply dynamic optimisations which are the key technique for making a language like Python fast, but more predictable and regular as the dynamic optimisations that PyPy uses are vulnerable to performance cliffs.
Re:Nuitka: a Python compiler by radarsat1 on Thursday September 28, 2017 @08:15AM (#15356520)
Are there any profile-guided optimisation methods for Python? Like, something that saves information from PyPy's dynamic optimisations on first run and uses them later for an AOT approach?
Re:Nuitka: a Python compiler by stevedonovan on Thursday September 28, 2017 @08:16AM (#15356523)
Yes, compare to LuaJIT. On a good day, it can bite C's shiny metal ass, but consistent and reliable application performance requires intimate knowledge of those performance cliffs.
Re:Nuitka: a Python compiler by Sean1708 on Thursday September 28, 2017 @09:53AM (#15357107)
> it can bite C's shiny metal ass

Can it actually? I've certainly seen benchmark's where a JITed program is comparable/marginally faster than a C program, but I've never seen one where it outright trounces C.

Re:Nuitka: a Python compiler by xapata on Thursday September 28, 2017 @10:36AM (#15357379)
Yes. A jit compiler can compile based on both code and data, and can compile all the dependencies. In contrast an aot compiler must only use the code and links to other pre-compiled binaries.

Further, a jit can compile to specific hardware. An aot must anticipate what hardware is possible. If you aot compile to several possible hardware configs, then you'll bloat the binary.

Re:Nuitka: a Python compiler by MaxBarraclough on Thursday September 28, 2017 @10:51AM (#15357491)
> In contrast an aot compiler must only use the code

Not since the development of "profile-guided optimisation", no.

Re:Nuitka: a Python compiler by xapata on Friday September 29, 2017 @01:46AM (#15363013)
Ok, then you've got the code and the profile. The actual data and hardware it happens to be using is still better information.
Re:Nuitka: a Python compiler by MaxBarraclough on Monday October 02, 2017 @07:27PM (#15388816)
> The actual data and hardware it happens to be using is still better information.

That's certainly what HotSpot's promoters want us to believe, but I'm not convinced there's a lot of extra value in having detailed data on the current run, compared to 'static' profile-guided optimisation. I'm not sure if there's been any serious study of this question.

As to the specific hardware: this might matter for things like SIMD, yes, but often won't make any appreciable difference. Some Linux distros have the user compile almost everything locally, but aren't all that much faster for it.

Re:Nuitka: a Python compiler by Sean1708 on Friday September 29, 2017 @07:53AM (#15364471)
Which is great in theory, but what was intending to ask was are there any actual examples of JITed programs which beat C by a large margin? Because, as I say, I've only ever seen ones which are comparable to C.
Re:Nuitka: a Python compiler by xapata on Friday September 29, 2017 @01:32PM (#15367293)
Trouble is, you don't tend to write a big program in two languages the exact same way. The rewrite nearly always wins because of algorithm improvements and cleaning cruft. So it's hard to benchmark.

If two small programs are about the same speed in C vs JITlang, then the theory says the JITted one should take over as the program gets bigger.