News for hackers. Stuff that matters.
Re:Why I Use Nim instead of Python for Data Processing by CraigJPerry on Saturday September 25, 2021 @05:27AM (#28651748)
The thing with Python is it's usually pretty easy to optimise quite impressively.

E.g. random example:

Sprinkle some cdef's in your python and suddenly you're faster than c++

https://github.com/luizsol/PrimesResult

https://github.com/PlummersSoftwareLLC/Primes/blob/drag-race...

25.8 seconds down to 1.5

Re:Why I Use Nim instead of Python for Data Processing by Jensson on Saturday September 25, 2021 @09:01AM (#28652832)
I've tried cython and it isn't competitive with C in real world cases. Cherry picking a case where it is competitive doesn't help your case. Its performance tend to be around the level of Java, another language people say is competitive or faster than C++ but in practice C++ is still twice faster than Java in most cases.

Still, getting Java level performance out of python is a huge improvement and should be enough for most cases.

Re:Why I Use Nim instead of Python for Data Processing by CraigJPerry on Saturday September 25, 2021 @02:18PM (#28655055)
Ahh my point was more that you can score a 17x performance boost with minimal effort rather than any absolute performance advantage over c++.

For a c++ comparison python would be much better pointing out the productivity advantage it has over the notoriously low productivity of c++ development - rather than competing on execution performance.

Re:Why I Use Nim instead of Python for Data Processing by PartiallyTyped on Saturday September 25, 2021 @01:58PM (#28654933)
There is also numba, which is very impressive in its own right, and also pypy, which supports features up to Python 3.7.

Some may consider Jax, and its XLA compiler, but unless you require gradients, numba will be significantly faster, an instance of this is available here [1].

XLA runs on a higher level than LLVM and therefore can't achieve the same optimizations as numba does using the latter. IIRC numba also has a Python to Cuda compiler, which is also very impressive.

[1] https://github.com/scikit-hep/iminuit/blob/develop/doc/tutor...

Re:Why I Use Nim instead of Python for Data Processing by stavros on Saturday September 25, 2021 @05:53AM (#28651851)
Apparently mypyc does the same if you have types in your code, though I've never used it.