News for hackers. Stuff that matters.
Re:Cinder: Instagram's performance-oriented fork of CPython by sammorrowdrums on Wednesday May 05, 2021 @03:43AM (#27047216)
I was doing a Hacker Rank puzzle yesterday in Python and after I optimised it, it still timed out on one input. Looked at the chat, and saw a comment "just run it with PyPy" and naturally it then passed all parts.

It's easy to forget that CPython is not that optimised generally, but as soon as you need to deal with algorithms it is lacking often.

I think even that the fact there are so many C implementations in libraries shows that the lack of optimisation for the sake of clean compiler code manifests as a readability / complexity issues elsewhere.

Re:Cinder: Instagram's performance-oriented fork of CPython by FartyMcFarter on Wednesday May 05, 2021 @05:45AM (#27047967)
> It's easy to forget that CPython is not that optimised generally,

"Not that optimised" is actually an understatement. In my experience, CPU-heavy code typically becomes 10-100x faster if you port it from Python to a language like C (without even trying to be clever or using SIMD assembly).

Re:Cinder: Instagram's performance-oriented fork of CPython by stevesimmons on Wednesday May 05, 2021 @08:03AM (#27048827)
Often you can put a "@numba.jit" decorator at the top of a calc-heavy function, and reclaim a good portion of C's performance.

It is so simple it is definitely worth trying.

I did it for Bloom tree implementation, and got to within around 3x of the C code it replaced.