from Hacker News

Faster CPython Ideas – Issue Tracker for Faster CPython Project

by patrick91 on 5/13/21, 10:05 AM with 90 comments

  • by patrick91 on 5/13/21, 10:05 AM

    Presentation from Guido van Rossum at the Python Language Summit: https://github.com/faster-cpython/ideas/blob/main/FasterCPyt...
  • by etaioinshrdlu on 5/13/21, 3:46 PM

    I updated a large Django project from python2.7 to 3.9 recently. Afterward, I was pleased that the app was both faster and used less than half the memory. It was somewhat surprising that the new version was so much better - most software seems to typically get only heavier over time!

    So, I take this as a good sign that progress will continue.

  • by kzrdude on 5/13/21, 12:04 PM

    This is exciting! So that we don't miss the main point: Eric Snow, GvR and Mark Shannon will be working for Microsoft to improve Python performance.

    In a way, it seems like Mark Shannon found someone to take him up on his offer on a plan for speeding up Python.

  • by pca006132 on 5/13/21, 2:47 PM

    Just wondering, why is CPython a lot slower than JS? It seems to me that both languages are interpreted and comes with some reflection functionalities (like modifying object methods), but JS seems a lot faster in most of the benchmarks in https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

    Edit: Why is this being downvoted? Is my statement incorrect or offensive to some people?

  • by fdej on 5/13/21, 12:27 PM

    I'd like to see optimizations targeting ctypes, or a successor to ctypes. I wish I could write elegant, performant C wrappers in pure Python. Right now the best choices are Cython, which is a hassle (separate, slow compilation, various warts), and ctypes, which is slow (and has some design problems of its own). Julia's ccall alone is a major selling point over Python right now.
  • by milliams on 5/13/21, 10:49 AM

    I posted the link to the first PEP yesterday (https://news.ycombinator.com/item?id=27134290) I think this looks like a very promising project.
  • by The_rationalist on 5/13/21, 3:04 PM

    The python JIT that promise to get the highest throughput once maturity reached is https://github.com/oracle/graalpython
  • by ForHackernews on 5/13/21, 2:48 PM

  • by bla3 on 5/13/21, 1:28 PM

    It's good to see that python startup time is an explicit goal. Empty scripts taking 10-100ms is a problem if you use python in Makefiles, where you can have thousands of invocations in a build. This wasn't considered a use case upstream cared about for quite some time. I'm glad to see this is changing. Here's hoping the acknowledgement will result in concrete gains!
  • by morelisp on 5/13/21, 7:46 PM

    Stage 2 should've been the selling point of Python 3.

    If there's really a 50% general speed boost sitting around in "normal" bytecode optimization work (and having read a decent amount of CPython I believe there could be), that's a criminal amount of energy over the past decade instead wasted dealing with what the type of a codepoint sequence should be named.

  • by etskinner on 5/13/21, 4:12 PM

    Why isn't this hosted at https://github.com/python/cpython/issues ?
  • by guggle on 5/14/21, 2:39 PM

    It really reminds me of this hilarious 2008 keynote by Cal Henderson: https://youtu.be/i6Fr65PFqfk?t=2255

    (relevant graphic: https://ibb.co/yV6bN9H )

  • by cpeterso on 5/13/21, 7:44 PM

    Guido's slides in the repo mention speedup targets, but there is no mention of benchmarks. What is measured gets optimized, but which benchmarks are important for Python users? I'm sure Django users and Numpy users have very different performance bottlenecks.
  • by frankreyes on 5/14/21, 12:27 PM

    This project is dead already. Lua is 4x faster out of the box compared to Python (without LuaJIT!). Lua got fast by having ints and floats at the local side of values, not as a reference. That's in, the int and float value is in the variable itself, not as a reference with a pointer indirection. In Python, every time you do a=a+1 new memory allocation is made for the a+1 object. Java has the same performance issue with boxed types (new Integer), and this is why C# is faster in many benchmarks. (C# cheated with the hindsight advantage of knowing which were Java mistakes)
  • by sergiomattei on 5/13/21, 1:20 PM

    This is the most exciting development I've seen in the Python scene in years!

    Thanks, Guido and team!

  • by punnerud on 5/13/21, 10:54 AM

    Deleted. Posted the wrong place. Thanks for the comments.
  • by obviousbob on 5/13/21, 6:05 PM

    CPython's arcane constraints are holding it back - GIL, C API with a global interpreter instance, ref-counting, to name a few.

    PyPy is already a drop-in replacement for CPython with JIT and using a fraction of the memory.

    https://dev.nextthought.com/blog/2018/08/cpython-vs-pypy-mem...