[pypy-dev] Numpy on pypy
Armin Rigo
arigo at tunes.org
Thu Jun 12 11:00:00 CEST 2014
Hi,
On 11 June 2014 07:32, Gayathri J <usethisid2014 at gmail.com> wrote:
> I am trying to do a matrix dot using numpy.dot
>
> the numpy.dot on pypy seems lot slower than bumpy.do on python
> is there an alternative to using numpy.dot - so that i can do matrix.dot on
> pypy faster than cpython....
For reference, I think you are misunderstanding PyPy somewhere.
Assume that there existed a general-purpose self-contained algorithm
to run matrix.dot(a,b) 10 times faster, written in C or Fortran.
Don't you think that the same algorithm would be used by CPython's
numpy too?
PyPy can't magically speed up a _single_ operation that takes a lot of
time. What PyPy can do is optimize some complex Python code between
such operations. In some cases it can also select more optimized
versions of the operations based on information from the Python
context.
For example, if you are timing how long it takes to do ``x =
3**10000000``, then there is no chance it would be faster on PyPy than
on CPython. But if you're writing in Python an algorithm that
computes the same result, then this Python code would run much faster
on PyPy than on CPython.
Another example is that the time it takes to compare two very big
strings should be the same; but if we know that one string is always
"A", then the comparison ``s == "A"`` can be optimized by selecting a
special string comparison for length one.
A bientôt,
Armin.
More information about the pypy-dev
mailing list