[Stackless] Slowdown when running Numpy with Stackless?

Bin Huang bin.arthur at gmail.com
Sun May 5 04:57:55 CEST 2013

Hi list,

I have observed slowdown when running Numpy with Stackless compared to
running it with CPython. The slowdown can be significant when problem size
is large. I wish someone in this mailing list can give me some hints on
this issue. I also post performance results and my source code here.

My platform is a 12-core dual-socket SMP machine running Ubuntu (Linux
kernel 3.2.0). On this platform, I have CPython 2.7.3, Numpy 1.6.1, and
Stackless Python 2.7.2 installed.

In order to test which Python implementation runs Numpy better, I wrote a
piece of code that simply performs matrix-matrix multiplication using one
of Numpy's functions. The source code is listed as follows:

*if __name__ == "__main__":
    import numpy, random, time
    import sys

    size = int(sys.argv[1]) # For simplicity, we only test square matrix

    matrix_a = numpy.matrix(numpy.random.randn(size,size))
    matrix_b = numpy.matrix(numpy.random.randn(size,size))

    start_time = time.time()
    result = numpy.dot(matrix_a, matrix_b)
    print '%0.3f ms' % ((time.time() - start_time)*1000.0)*
I run this code with both CPython and Stackless Python. Here is performance
numbers I got:

Problem size    CPython             Stackless           Slowdown
256x256           14.112 ms           40.003 ms         ~2.9X
512x512           109.965 ms         353.292 ms       ~3.2X
1024x1024       871.251 ms        8771.153 ms      ~10X
2048x2048       8214.799 ms      86479.872 ms    ~10.5X
4096x4096       69790.130 ms    822476.506 ms  ~11.8X

Any ideas? Thanks in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20130504/075a5786/attachment.html>

More information about the Stackless mailing list