[HN Gopher] PyPy v7.3.16
       ___________________________________________________________________
        
       PyPy v7.3.16
        
       Author : lumpa
       Score  : 98 points
       Date   : 2024-04-24 10:18 UTC (12 hours ago)
        
 (HTM) web link (www.pypy.org)
 (TXT) w3m dump (www.pypy.org)
        
       | giancarlostoro wrote:
       | I never really did much with PyPy, do people mostly use it in a
       | deployed application setting? I ask because looking over at the
       | PyPy Speed page...
       | 
       | https://speed.pypy.org/
       | 
       | Looks like Django is insanely faster under PyPy. Feels like a
       | potential waste not to use PyPy on a deployed web app in most
       | cases. I wonder how FastAPI scales with PyPy and other Python
       | interpreters.
        
         | JulianWasTaken wrote:
         | At least for me / my former $WORK, the answer was "definitely
         | yes we used it in deployed applications", we saved more than
         | $1M (this in ~2015) _annually_ in infrastructure costs by quite
         | literally switching from CPython to PyPy and never really
         | looked back, but obviously there are many considerations
         | involved there that are going to be specific to your (company
         | 's) application(s) and infrastructure.
        
         | jmg_ wrote:
         | Note they're comparing to CPython v3.7 and while
         | https://speed.python.org doesn't go back to 3.7, the
         | improvements between 3.8 to 3.12 are pretty massive.
         | 
         | I don't doubt PyPy is faster than CPython, but it would be very
         | interesting to see latest PyPy compared to latest CPython.
        
         | doix wrote:
         | I used it at my old job specifically to speed up a Django
         | application.
         | 
         | After a bunch of profiling, I narrowed down a bunch of our
         | performance problems to the ORM doing a bunch of __setattr__
         | (or something, it was a long time ago).
         | 
         | We could have started rewriting everything and using .values()
         | (or something, basically get back tuples instead of python
         | objects) but switching to PyPy got the performance to good
         | enough without having to sacrifice DX.
         | 
         | It's been a long time, so I'm a bit fuzzy on the details, but I
         | definitely recommend PyPy for Django unless there's some reason
         | you can't use it.
        
         | mdaniel wrote:
         | In my specific circumstance it behaved like a statically
         | linked, one-.tar-and-ready mechanism to get python onto Flatcar
         | (nee CoreOS, but not the modern one). So my case for it wasn't
         | speed it was the dead simple deploy
        
         | lend000 wrote:
         | I used it in production for a while, but it caused instability
         | with pandas and often froze so I had to take it out. It does
         | have some serious speed benefits for simple / pure-Python
         | without compiled libraries.
        
         | eugenekolo wrote:
         | I run it in a production environment (side project). I also use
         | it locally when developing when necessary.
         | 
         | It really does speed up loops by 5x or so.
         | 
         | So when you're trying to say... test 100 million+ iterations of
         | something, pypy will run that in something like 2 minutes
         | versus cpython can take me 15 minutes.
         | 
         | Honestly it's an amazing performance gain for 0 effort, and I
         | have yet to run into a limitation with it.
        
         | ktm5j wrote:
         | I've put a bit of effort into trying to make it work with the
         | python apps we write at my company. We have a lot of electrical
         | engineers who only write python and we're butting up against
         | the limit of what the language can do as far as the data we
         | need to process..
         | 
         | It's worked well in some cases, but the main situation where we
         | needed it to work was with a GUI application where there was no
         | separation between computation and the GUI elements.. I tried
         | really hard, and got frustratingly close, but could not build
         | wxPython that would work using pypy.
         | 
         | But it's super cool imo, as someone who has to write/maintain
         | python code it's awesome to see some innovative work to make
         | the language faster.
        
       | abeppu wrote:
       | Does PyPy still release 2.7 because RPython is still based on it?
       | 
       | I was recently trying to play with RPython for the first time,
       | and having to remember all the python 2 vs python 3 differences
       | felt strange, and very retro.
        
         | JulianWasTaken wrote:
         | _Developing_ / helping contribute to PyPy may mean touching 2.7
         | in its toolchain which is used to implement it, but no, users
         | using it have been able to use 3.x for a very very long time
         | now.
        
           | abeppu wrote:
           | You'll note I said I was playing with RPython, not PyPy. In
           | my case, I was playing with writing a small interpreter, and
           | comparing the RPython toolchain with the Truffle/Graal
           | framework.
           | 
           | Writing RPython code, even if one is not developing or
           | contributing to PyPy, means writing within a subset of python
           | 2.
           | 
           | > RPython ("Restricted Python") is a subset of Python 2
           | 
           | https://www.pypy.org/posts/2022/04/how-is-pypy-tested.html
           | 
           | And RPython's translator specifically uses pypy, and uses
           | python 2 syntax:
           | 
           | https://github.com/pypy/pypy/blob/main/rpython/bin/rpython#L.
           | ..
           | 
           | ... so getting the RPython toolchain (even if one is
           | intending to improve the PyPy 3+ interpreters) requires
           | setting up a pypy 2 interpreter. Hence the question in my
           | post.
        
       | albertzeyer wrote:
       | Is there an overview of the user share of PyPy vs CPython? I have
       | the feeling that PyPy usage became less in the recent years.
       | 
       | How well does PyPy work together with frameworks like PyTorch,
       | JAX, TensorFlow, etc? I know there has been some work to support
       | NumPy, but I guess all these other frameworks are much more
       | relevant nowadays.
        
         | westurner wrote:
         | "Writing extension modules for pypy"
         | https://doc.pypy.org/en/latest/extending.html ; CFFI, ~ ctypes
         | (libffi), cppyy, or RPython
        
       | candl wrote:
       | I recently had to script reading a large Excel XLSB file. Using
       | pyxlsb it took about two minutes. I found an alternative library
       | with significally better performance - python-calamine, but this
       | one reads all the data to memory consuming GBs of RAM, so was a
       | no starter. Then I tried PyPy and miraculously the same script
       | with pyxlsb takes 15 seconds.
        
       | sneed_chucker wrote:
       | Still crazy to me that Python is this popular in all sorts of
       | production uses without a JIT reference implementation.
        
         | notatallshaw wrote:
         | A JIT is now available in CPython main, it's not that
         | performant yet so won't be turned on for Python 3.13 by
         | default, informational PEP is here (still being reviewed, check
         | the discourse thread for more details):
         | https://peps.python.org/pep-0744/
        
       | singularity2001 wrote:
       | Too bad they don't compile to wasm. Shouldn't be tooo hard.
        
       | brian_herman wrote:
       | Why do they have 3.9 and 3.10 is it their policy to have two
       | previous versions for every release?
        
         | mattip wrote:
         | We try to keep around useful versions of Python3, based on what
         | wheels packagers make available. NumPy<2 provides PyPy3.9
         | wheels, and we have PyPy3.10 ready. Now that NumPy has moved to
         | PyPy3.10 wheels, we will probably drop 3.9. Help is needed to
         | move forward to 3.11/3.12.
        
       ___________________________________________________________________
       (page generated 2024-04-24 23:01 UTC)