←back to thread

I don't like NumPy

(dynomight.net)
480 points MinimalAction | 2 comments | | HN request time: 0.411s | source
Show context
ChrisRackauckas ◴[] No.43998345[source]
One of the reasons why I started using Julia was because the NumPy syntax was so difficult. Going from MATLAB to NumPy I felt like I suddenly became a mediocre programmer, spending less time on math and more time on "performance engineering" of just trying to figure out how to use NumPy right. Then when I went to Julia it made sense to vectorize when it felt good and write a loop when it felt good. Because both are fast, focus on what makes the code easiest to read an understand. This blog post encapsulates exactly that experience and feeling.

Also treating things like `np.linalg.solve` as a black box that is the fastest thing in the world and you could never any better so please mangle code to call it correctly... that's just wrong. There's many reasons to build problem specific linear algebra kernels, and that's something that is inaccessible without going deeper. But that's a different story.

replies(4): >>43998533 #>>43998779 #>>43999127 #>>43999507 #
jampekka ◴[] No.43998779[source]
> Going from MATLAB to NumPy I felt like I suddenly became a mediocre programmer, spending less time on math and more time on "performance engineering" of just trying to figure out how to use NumPy right.

Matlab is about as slow without readily vectorized operations as Python.

Slowness of Python is a huge pain point, and Julia has a clear advantage here. Sadly Julia is practically just unusable beyond quite niche purposes.

Python does now have quite serviceable jit hacks that let one escape vectorization tricks, but they are still hacks and performant Python alternative would be very welcome. Sadly there aren't any.

replies(6): >>43999029 #>>43999037 #>>43999826 #>>44001248 #>>44007445 #>>44007523 #
bandrami ◴[] No.43999826[source]
R
replies(1): >>43999979 #
1. jampekka ◴[] No.43999979[source]
R is for sure not a Python replacement. And it's even slower than Python.
replies(2): >>44000870 #>>44006239 #
2. bandrami ◴[] No.44006239[source]
R has significant performance advantages over Python if you are keeping it in its lane. But it's a DSL and not a general-purpose language.