[pypy-issue] [issue1630] Matrix dot product ~5x slower in PyPy

Gareth Williams tracker at bugs.pypy.org
Tue Nov 5 13:24:29 CET 2013

New submission from Gareth Williams <gareth.gambit at gmail.com>:

Running the following code in PyPy takes around 5 times longer than it does when 
using standard Numpy matrix dot products.

import time

    import numpypy
except ImportError:

import numpy

def get_matrix():
    import random
    n = 502
    x = numpy.zeros((n,n), dtype=numpy.float64)
    for i in range(n):
        for j in range(n):
            x[i][j] = random.random()
    return x

def main():
    x = get_matrix()
    y = get_matrix()
    a = time.time()
    z = numpy.dot(x, y)
    b = time.time()
    print '%.2f seconds' % (b-a)

messages: 6299
nosy: garethgambit, pypy-issue
priority: performance bug
status: unread
title: Matrix dot product ~5x slower in PyPy

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list