[Numpy-discussion] python numpy code many times slower than c++

Robert Kern robert.kern@gmail....
Fri Jan 23 02:19:59 CST 2009


On Thu, Jan 22, 2009 at 17:09, Wes McKinney <wesmckinn@gmail.com> wrote:
> Windows XP, Pentium D, Python 2.5.2

I can replicate the negative numbers on my Windows VM. I'll take a look at it.

Wrote profile results to foo.py.lprof
Timer unit: 4.17601e-010 s

File: foo.py
Function: f at line 1
Total time: -3.02963 s

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
     1                                           @profile
     2                                           def f():
     3   1000001  -1456737621  -1456.7     20.1         for i in
xrange(1000000):
     4   1000000  -1540435131  -1540.4     21.2                 1+1
     5   1000000  -1522306067  -1522.3     21.0                 1+1
     6   1000000  -1177199444  -1177.2     16.2                 1+1
     7   1000000  -1558164209  -1558.2     21.5                 1+1


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list