9 ms·
For those asking "who uses PyPy?": the truth is that very few people using it get back to us and say how it helps them or what they are doing with it. For insta
by mattip 6y ago
For those asking "who uses PyPy?": the truth is that very few people using it get back to us and say how it helps them or what they are doing with it. For instance crossbar.io uses it [0]. Some shops use it as a second step until they refactor code into a compiled language, but often that second step never materializes.
But the value of a second implementation of a language goes beyond the immediate "who uses this in practice". It can be a fertile bed for innovation and for new ideas, and provides a contrast to the nay sayers. For instance, the recent pitch to vastly improve CPython's speed has some roots in ideas that were tested out in PyPy. CFFI [1], revdb [2] and vmprof [3] all started as PyPy projects. Some of these turned out to be very popular, some less so. The next project in this line is HPy [4] (still alpha-quality), which is trying to re-think the C-API for Python to make it even easier to interface with.
RPython [5], the language behind PyPy, is also an accessible playground for dynamic language research.
[0] https://crossbar.io/about/FAQ/#python-runtime https://crossbar.io/about/FAQ/#python-runtime
[1] https://cffi.readthedocs.io/en/latest/ https://cffi.readthedocs.io/en/latest/
[2] https://morepypy.blogspot.com/2016/07/reverse-debugging-for-python.html https://morepypy.blogspot.com/2016/07/reverse-debugging-for-...
[3] https://vmprof.readthedocs.io/en/latest/ https://vmprof.readthedocs.io/en/latest/
[4] https://hpy.readthedocs.io/en/latest/ https://hpy.readthedocs.io/en/latest/
[5] https://rpython.readthedocs.io/en/latest/examples.html https://rpython.readthedocs.io/en/latest/examples.html
- bobajeff 6y agoTo add I believe PyPy also inspired asm.js the precursor to Web Assembly.
- Recursing 6y agoAFAIK pypy improvements also led to cpython compact dictionaries (which led to dictionaries being ordered) and many many cpython performance improvements (the most recent one being LOAD_ATTR caching, with huge performance gains). I wonder if sponsoring pypy instead of the PSF might be a way for people that want "a focus on performance improvements, instead of fancy features" to vote with their wallets
- ngfellow 6y agoIt is worth noting that none of the PSF donations arrive at core development anyway. They support the bureaucracy and the infrastructure. python.tar.gz would be exactly the same if the donations were zero. All the more reason to switch to donating PyPy.
- tzl 6y agoInstead of downvoting, google the financial statements and see for yourself. You are supporting bureaucracy/infra/conferences. All of which would not exist without python.tar.gz.
- dmw_ng 6y agoGoing by https://www.python.org/psf/annual-report/2020/ https://www.python.org/psf/annual-report/2020/ , 75% are running the annual conference, 12.6% grants open to _anyone_, and 3.8% maintaining a central registry primarily staffed by volunteers, and I imagine paying for quite a sizeable set of origin servers at this stage. As for the PyCon expenditure, it's certainly the kind of thing I'd never attend, but there can be no doubt the existence of the conference has strengthened and grown Python's user base, and it is open to everyone should they wish to attend. Meanwhile, $97k annual to operate a package registry with literally millions of downloads per month that tens of thousands of companies depend on sounds like an amazing bargain to me.
- incongruity 6y agoSpeaking as someone who had a core role in organizing PyCon US a decade+ ago and was active with the PSF for some time, I’ve never seen an organization more dedicated to good stewardship and inclusiveness at scale. I’m sure there are other great examples but the PSF was always commendable. PyCon was always meant to be affordable for as many people as it could be - via low prices and financial aid for many. Those conferences helped create many of the relationships that drove key parts of the Python ecosystem. In addition, there are/were typically dedicated time for code sprints following the main conference. Important work happened there, often for key parts of the Python codebase or key libraries. While the budget numbers don’t say explicitly “development support” people shouldn’t presume PyCon does nothing for the language itself. Open Source conferences are not like commercial conferences. It’s community driven rather than marketing driven. That difference matters. It was a smaller world when I was involved but it was and still is something special.
- ghj 6y agoIf you want more examples of real world use cases, PyPy is pretty stress-tested by the competitive programming community already. https://codeforces.com/contests https://codeforces.com/contests has around 20-30k participants per contest, with contests happening roughly twice a week. I would say around 10% of them use python, with the vast majority choosing pypy over cpython. I would guesstimate at least 100k lines of pypy is written per week just from these contests. This covers virtually every textbook algorithm you can think of and were automatically graded for correctness/speed/memory. Note that there's no special time multiplier for choosing a slower language, so if you're not within 2x the speed of the equivalent C++, your solution won't pass! (hence the popularity of pypy over cpython) The sheer volume of advanced algorithms executed in pypy gives me huge amount of confidence in it. There was only one instance where I remember a contestant running into a bug with the jit, but it was fixed within a few days after being reported: https://codeforces.com/blog/entry/82329?#comment-693711 https://codeforces.com/blog/entry/82329?#comment-693711 https://foss.heptapod.net/pypy/pypy/-/issues/3297 https://foss.heptapod.net/pypy/pypy/-/issues/3297.
- gabagool 6y agoWhy do competitive Python programmers use PyPy instead of CPython?
- neolog 6y agoPyPy is much faster than CPython.
- Guthur 6y agoFor some cases, and the picture often changes. We were using pypy because it was better for our use case at one point but then later on we retested cpython and found the picture had changed. We believe this was due to significant improvements in the regex engine for cpython over the period, but could also be due to our code base changing. The point being it is not a given that pypy is faster.
- ghj 6y ago
- dheera 6y agoWhy isn't Ubuntu shipping it as the default python?
- wongarsu 6y agoSome popular libraries don't work on PyPy because of their C code.
- cgearhart 6y agoI have turned to pypy quite extensively for pure-Python text processing tasks, where I often get a 10-100x speed up just by changing the command line invocation. For example, I wrote a proof of concept Rabin-Karp hashing approximate string matching algorithm to perform plagiarism analysis while I was working at Udacity in around 2017. The system never went into production, but pypy was super helpful in crunching all historical user submissions for analysis. I’ve also had great success using pypy to accelerate preprocessing steps (when they don’t rely on incompatible c libraries) for machine learning pipelines. It’s the most painless performance enhancement trick in my toolbox before I reach for concurrency (in which case I reach for joblib or Dask). The one oddity I’ve noticed is that using tuples (including things like named tuples) often speeds up CPython by a lot, but even plain tuples can slow down pypy on the same code—in some cases pypy winds up slower than CPython. In any case, I’m low key in love with pypy, even though I can’t use it for _everything_.
- sitkack 6y ago> The one oddity I’ve noticed is that using tuples (including things like named tuples) often speeds up CPython by a lot, but even plain tuples can slow down pypy on the same code—in some cases pypy winds up slower than CPython. I'd love for this to be addressed. namedtuple should be lowered into a fixed sized struct, great opportunity for PyPy to show wins in both memory, memory bandwidth and compute. Add in type stability and PyPy should approach native speeds just by adding in namedtuple.
- mattip 6y agoI created an issue [0] to address this. Could you add a microbenchmark that demonstrates the problem? [0] https://foss.heptapod.net/pypy/pypy/-/issues/3373 https://foss.heptapod.net/pypy/pypy/-/issues/3373
- olliemath 6y agoWe use pypy pretty extensively at our firm for analytics/olap work. We've actually tried using some of the more traditional libs (Pandas et al) with CPython, but there's always a pure-python bottleneck (e.g. SQLAlchemy). Performance is important to our clients and trying to keep everything performance critical in C extensions / NumPy would be kind of risky for us when adding new functionality, so pypy's guarantee of more speed pretty much across the board is awesome. There are downsides of course - higher memory usage, longer boot times, some more obscure libraries being unsupported - but on the whole, it's a good choice for us