[HN Gopher] When NumPy is too slow
       ___________________________________________________________________
        
       When NumPy is too slow
        
       Author : ingve
       Score  : 15 points
       Date   : 2023-06-28 19:35 UTC (3 hours ago)
        
 (HTM) web link (pythonspeed.com)
 (TXT) w3m dump (pythonspeed.com)
        
       | credit_guy wrote:
       | I don't get it. If code written in numpy is slow because the
       | algorithm is bad, and you need to rewrite it, we can't say "numpy
       | is too slow". A good chunk of the blogpost talks about this
       | particular case, which is a non-case.
       | 
       | The rest is some vague suggestions to use numba, or jax. But if
       | your code is vectorizable in my experience you don't get any
       | benefit from numba and jax. With the exception that jax is by
       | default single-precision so you get some speed up from that. If
       | you make it double precision, you get back to numpy speed. I
       | suppose the author's conclusion is not all that different,
       | otherwise they'd put a code snippet and show some numbers.
        
         | tnecniv wrote:
         | I have definitely gotten significant speed ups using Jax. I try
         | to vectorize my code as much as possible but that's not always
         | feasible for every aspect of an algorithm. Even for the
         | vectorized operations, the JIT compilation gets me a speed up
         | when used correctly (I.e. structuring code to minimize
         | recompiling). Jax also has the added bonus of trivially running
         | your algorithm on the GPU.
        
       ___________________________________________________________________
       (page generated 2023-06-28 23:02 UTC)