mikefc <[email protected]> added the comment:
I should have pointed out that this is for 10million function calls each.
Note that in PyPy, the pure python dotproduct is 3x faster than the numpypy
one.
I guess the overhead in setting up iterators/whatever in numpypy for these
short (length=4) vectors makes it more
expensive than just the manual unrolling of the pure python version.
##############################
# CPython
##############################
As an extra example, I looked at running this under CPython2.7. Even the
fastest version under CPython is slower
than the slowest pypy code.
And I've just found out that the ndarray.ctypes attribute is probably being
created at call time, so no wonder it's
slower than casting the __array_attribute__.
numpypy dot 0.797430430847 0:00:11.081040
python dot 0.797430430847 0:00:30.281586
c dotproduct (cast to double *) 0.797430430847 0:01:21.851521
c dot. casting a.ctype.data 0.797430430847 0:02:14.366188
c dotproduct (cast outside loop) 0.797430430847 0:00:05.795226
________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1526>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-issue