[Numpy-discussion] slow numpy.clip ?

Stefan van der Walt stefan at sun.ac.za
Mon Dec 18 03:17:10 CST 2006


On Mon, Dec 18, 2006 at 05:45:09PM +0900, David Cournapeau wrote:
> Yes, I of course mistyped the < and the copy. But the function is still 
> moderately faster on my workstation:
> 
>   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>         1    0.003    0.003    3.944    3.944 slowclip.py:10(bench_clip)
>         1    0.011    0.011    2.001    2.001 slowclip.py:16(clip1_bench)
>        10    1.990    0.199    1.990    0.199 
> /home/david/local/lib/python2.4/site-packages/numpy/core/fromnumeric.py:372(clip)
>         1    1.682    1.682    1.682    1.682 slowclip.py:19(clip2_bench)
>         1    0.258    0.258    0.258    0.258 
> slowclip.py:6(generate_data_2d)
>         0    0.000             0.000          profile:0(profiler)

Did you try swapping the order of execution (i.e. clip1 second)?

Cheers
Stéfan


More information about the Numpy-discussion mailing list