News for hackers. Stuff that matters.
Re:Python 3.11 is faster than 3.8 by CalebJohn on Wednesday October 26, 2022 @02:17PM (#33347396)
Out of curiosity I ran the same test on a linux laptop with the Ryzen 7 PRO 6850U CPU.

    python 3.10: 60s
    python 3.11: 46s
    pypy 3.9.12:  6s
Looks like pypy performs comparatively better on x86_64
Re:Python 3.11 is faster than 3.8 by llimllib on Wednesday October 26, 2022 @02:29PM (#33347525)
makes sense I guess, it's had a lot more development time I'm sure. Thanks!
Re:Python 3.11 is faster than 3.8 by nerdponx on Wednesday October 26, 2022 @07:06PM (#33350815)
I think PyPy runs under Rosetta on M1, so the overhead is probably from that.
Re:Python 3.11 is faster than 3.8 by llimllib on Wednesday October 26, 2022 @08:43PM (#33351572)
I don't think so; they released ARM support a while ago: https://doc.pypy.org/en/latest/release-2.1.0.html

(I could be wrong)

edit: oh, huh I think you're right that it's running here on rosetta:

    $ file installs/python/pypy3.9-7.3.9/bin/pypy
    installs/python/pypy3.9-7.3.9/bin/pypy: Mach-O 64-bit executable x86_64
Wonder if there's a way to run a native version?

edit 2: there are nightlies here: https://buildbot.pypy.org/nightly/py3.9/

Running the latest, a native binary gives more than 2x speedup:

    # first you have to allow all the unsigned binaries to run
    $ xattr -dr com.apple.quarantine pypy-c-jit-106295-5dd3b18303e2-macos_arm64/bin/*
    # then we get 3.5s:
    $ time pypy-c-jit-106295-5dd3b18303e2-macos_arm64/bin/pypy nbody.py 10000000
    -0.169075164
    -0.169077842

    real 0m3.522s
    user 0m3.468s
    sys 0m0.045s
pypy continues to impress!