[Numpy-discussion] Slicing slower than matrix multiplication?

Pauli Virtanen pav+sp@iki...
Tue Dec 15 03:36:29 CST 2009

Mon, 14 Dec 2009 17:09:13 +0100, Francesc Alted wrote:
> which makes numpy 5x slower than matlab.  Hmm, I definitely think that
> numpy could do better here :-/

It could be useful to track down what exactly is slow, by profiling the 
actual C code. Unfortunately, profiling shared libraries is somewhat 

Some tools that I've seen to work (on Linux):

- Valgrind (+ KCacheGrind)

  Together with its cache profiler, this can give useful information
  on what is the slow part, and on which lines most of the time is spent.

- Oprofile

  Nice sample-based profiler, but requires root.

- Qprof (32-bit only)

  Good for quick sample-based profiling on function level.
  Easy to use.

- Sprof

  "The" way to profile dynamically linked libraries on Linux.
  Function-level, and slightly obscure to use.

So if someone wants to spend time on this, those are the tools I'd 
recommend :)

Pauli Virtanen

More information about the NumPy-Discussion mailing list