[pypy-dev] NumPyPy test - array creation slow
Mike Müller
mmueller at python-academy.de
Mon Feb 27 16:31:58 CET 2012
Hi,
I just tested NumPyPy a bit. I got very long run times
for some tests. After some profiling, I identified the
array constructor as the main time sink.
This is a small example that makes the point.
import cProfile
try:
import numpy
except ImportError:
import numpypy as numpy
def test():
r = range(int(1e7)) # or 1e6
numpy.array(r)
cProfile.run('test()')
The numbers are below. NumPyPy is like a factor of five
and more slower than NumPy creating an array of the same
size from an existing list.
I am just curious what the reason is and if you sees this
go away in the near future?
Thanks,
Mike
Mac OS X 10.7, Python 2.7.2, NumPy 2.0.0, 1e6
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.011 0.011 0.255 0.255 <string>:1(<module>)
1 0.002 0.002 0.244 0.244 constr.py:12(test)
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.210 0.210 0.210 0.210 {numpy.core.multiarray.array}
1 0.032 0.032 0.032 0.032 {range}
Mac OS X 10.7, PyPy 1.8 with NumPyPy, 1e6
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.955 0.955 <string>:1(<module>)
1 0.000 0.000 0.955 0.955 constr.py:12(test)
1 0.955 0.955 0.955 0.955 {_numpypy.array}
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {range}
Mac OS X 10.7, Python 2.7.2, NumPy 2.0.0, 1e7
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.166 0.166 2.586 2.586 <string>:1(<module>)
1 0.016 0.016 2.420 2.420 constr.py:12(test)
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 2.065 2.065 2.065 2.065 {numpy.core.multiarray.array}
1 0.339 0.339 0.339 0.339 {range}
Mac OS X 10.7, PyPy 1.8 with NumPyPy, 1e7
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 10.169 10.169 <string>:1(<module>)
1 0.000 0.000 10.169 10.169 constr.py:12(test)
1 10.169 10.169 10.169 10.169 {_numpypy.array}
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {range}
Windows, Python 2.6.5, NumPy 1.6.1, 1e6
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.009 0.009 0.242 0.242 <string>:1(<module>)
1 0.000 0.000 0.234 0.234 constr.py:12(test)
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.191 0.191 0.191 0.191 {numpy.core.multiarray.array}
1 0.042 0.042 0.042 0.042 {range}
Windows, PyPy 1.8 with NumPyPy, 1e6
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1.375 1.375 <string>:1(<module>)
1 0.000 0.000 1.375 1.375 constr.py:8(test)
1 1.375 1.375 1.375 1.375 {_numpypy.array}
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {range}
Windows, Python 2.6.5, NumPy 1.6.1, 1e7
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.092 0.092 2.775 2.775 <string>:1(<module>)
1 0.002 0.002 2.683 2.683 constr.py:12(test)
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 2.254 2.254 2.254 2.254 {numpy.core.multiarray.array}
1 0.427 0.427 0.427 0.427 {range}
Windows, PyPy 1.8 with NumPyPy, 1e7
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 13.937 13.937 <string>:1(<module>)
1 0.001 0.001 13.937 13.937 constr.py:12(test)
1 13.936 13.936 13.936 13.936 {_numpypy.array}
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 {range}
More information about the pypy-dev
mailing list