[Numpy-discussion] Numpy Overhead
Matthew Brett
matthew.brett at gmail.com
Tue Feb 28 18:18:07 EST 2017
Hi,
On Tue, Feb 28, 2017 at 3:04 PM, Sebastian K
<sebastiankaster at googlemail.com> wrote:
> Yes you are right. There is no need to add that line. I deleted it. But the
> measured heap peak is still the same.
You're applying the naive matrix multiplication algorithm, which is
ideal for minimizing memory use during the computation, but terrible
for speed-related stuff like keeping values in the CPU cache:
https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm
The Numpy version is likely calling into a highly optimized compiled
routine for matrix multiplication, which can load chunks of the
matrices at a time, to speed up computation. If you really need
minimum memory heap usage and don't care about the order of
magnitude(s) slowdown, then you might need to use the naive method,
maybe implemented in Cython / C.
Cheers,
Matthew
More information about the NumPy-Discussion
mailing list