Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would guess that the difference is static type information. Similar to how PyPy is faster than CPython, but Cython (and probably Nuitka and MyPyC) is faster than PyPt.


JITs don't need static type information, because they have that information available to them anyway. Cython is not a good example for performance comparisons, because while you can compile Python code unchanged with it, the performance gains are very modest, as Cython still uses the full, unabbreviated Python data model; it only cuts out the overhead of the CPython bytecode VM: everything else is still there, and that's what dominates. Cython also allows you to write C-with-a-Python-syntax, which then has the performance profile you'd expect from C - but you're not writing Python any more.


> JITs don't need static type information, because they have that information available to them anyway.

I've heard that V8 can specialize functions but will sometimes unspecialize them if you use them with unexpected types. Using static typing can push your code into patterns that "helps" the JIT, even if it doesn't use directly the type information that you wrote.


That's a good point.

As I hinted in my post, it might be more instructive to see if programs compiled with MyPyC or Nuitka run faster than PyPy or GraalPython.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: