News for hackers. Stuff that matters.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by optimalsolver on Sunday September 27, 2020 @11:12AM (#24607208)
Did you benchmark PyPy against numba?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @11:44AM (#24607476)
Doesn't numpy require changing the code? When it works, my understanding is that pypy is a drop-in replacement.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by devxpy on Sunday September 27, 2020 @12:09PM (#24607696)
OP said "numba", not "numpy" - numba is a JIT that's compatible with CPython!

https://numba.pydata.org/

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @12:52PM (#24608017)
Ah, I'd assumed a typo; thanks! However, I can't tell if/how much my concerns hold:

> You don't need to replace the Python interpreter, run a separate compilation step, or even have a C/C++ compiler installed. Just apply one of the Numba decorators to your Python function, and Numba does the rest.

(Emphasis mine)

Also, I can't tell whether https://numba.readthedocs.io/en/stable/user/5minguide.html#w... implies that some code won't work, or won't get faster?

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by devxpy on Sunday September 27, 2020 @03:28PM (#24609462)
Yes, some code won't work -- numba has a nice compiler that will show you errors if it cannot infer the type of even a single variable at compile time (which usually happens the first time you call your function at run-time).

The argument of "some code won't get faster" is null, since you typically only want to use `@njit`, which ensures that you're in `nopython` mode.

I guess that's a double edged sword, in that when it says `nopython`, it really does mean no python.

This means you can only use features from the python interpreter that the numba team has re-implemented in LLVM IR.

---

IIRC `@njit` does involve an overhead in `lowering` the types from python -> LLVM when the first njit function in the call graph is invoked, but not after that.

All this means that if you use `for-loops` in nopython mode, they are guaranteed to run faster, at least in my experience.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by nurettin on Sunday September 27, 2020 @11:49AM (#24607520)
It is, I ran python-neat with it. Almost doubled the speed.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by optimalsolver on Sunday September 27, 2020 @12:23PM (#24607799)
Who said anything about numpy?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @12:52PM (#24608022)
Ah, I'd assumed that was a typo