News for hackers. Stuff that matters.
Re:Python Programming and Numerical Methods: A Guide for Eng... by galangalalgol on Wednesday February 17, 2021 @11:19AM (#26168091)
I post this whenever it comes up, but lots of small matricies or any operation gets hit too hard by the ffi overhead into numpy.
Re:Python Programming and Numerical Methods: A Guide for Eng... by shepardrtc on Wednesday February 17, 2021 @12:02PM (#26168604)
Yes, for smaller stuff, numpy really does add a lot of overhead. It would make life much simpler if you could copy things into a numpy array more quickly, but oh well. In any case, you can find pretty tight pure Python code for most things. For instance, I needed to drop a relatively small Linear Regression calculation from like 500 microseconds using numpy or scipy (I don't remember) to double-digit microseconds somehow. I googled it for a little bit and after adapting some pure python code using regular lists, I got it into double digits. And then after converting the function rather easily into Cython (and just the function, not the entire program), its single-digit microseconds now.