[Numpy-discussion] GSoC : Performance parity between numpy arrays and Python scalars

David Cournapeau cournape at gmail.com
Thu May 2 00:42:16 EDT 2013


On Thu, May 2, 2013 at 5:25 AM, Arink Verma <arinkverma at iitrpr.ac.in> wrote:
> @Raul
> I will pull new version, and try to include that also.
> What is wrong with macros for inline function?
> Yes, time for ufunc is reduced to almost half, for lookup table, I am
> generating key from argument type and returning the appropriated value.[1]
>
> @Chuck
> Yes I did some profiling with oprofiler for "python -m timeit -n 1000000 -s
> 'import numpy as np;x = np.asarray(1.0)' 'x+x'". see data sheet.[2]
>
> As every time a ufunc is invoked, the code has to check every single data
> type possible (bool, int, double, etc) until if finds the best match for the
> data that the operation is being performed on. In scalar, we can send best
> match, from pre-populated table. At present the implementation is not
> well-structured and support only addition for int+int and float+float. [1]

You are pointing out something that may well be the main difficulty:
the code there is messy, and we need to ensure that optimisations
don't preclude later extensions (especially with regard to new dtype
addition).

David



More information about the NumPy-Discussion mailing list