Re:A New Chapter for PyPy
by laurencerowe on Thursday August 13, 2020 @01:17AM
(#24140153)
For algorithmic code PyPy can provide substantial speedups over CPython. I've used PyPy in code fingerprinting large bioinformatics files and seen big speedups. I've also tried porting a webapp processing JSON from CPython and seen no perceptible speedup.
[ Parent
| on HN ]
The JSON library is probably a C-extension so PyPy won't make it any faster.
Apparently that isn't always the case. See the PyPy Status Blog: PyPy's new JSON parser
https://morepypy.blogspot.com/2019/10/pypys-new-json-parser....
which talks about being more efficient with both deserialization and memory.
Re:A New Chapter for PyPy
by laurencerowe on Thursday August 13, 2020 @01:45PM
(#24146011)
It's a long time since I looked, but profiling my code not much time was spent parsing / serializing JSON. Most of the time spent was manipulating dicts/lists in Python which cPython is already pretty good at since the whole language seems to basically be implemented in terms of dicsts. I don't think PyPy has the hidden class optimizations of JS engines which are able to find speedups in these types of cases.
For algorithmic/numerical code, especially if you have to deal with numpy-related data, Numba has a much easier barrier for entry, plus you remain with cpython while speeding up computation-intensive code by a few orders of magnitude.
Re:A New Chapter for PyPy
by laurencerowe on Thursday August 13, 2020 @01:49PM
(#24146062)
Looks like numba has cffi support now so it would be an option. If I can dig out the code (it was about 5 years ago) I'll probably try adapting it to numba to benchmark it against pypy.