[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

try:
    import numpypy
except ImportError:
    pass

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)
    
main()

----------
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>
<https://bugs.pypy.org/issue1630>
________________________________________


More information about the pypy-issue mailing list