Changes between Version 4 and Version 5 of PossibleOptimizationAreas

Show
Ignore:
Timestamp:
02/27/06 17:16:39 (7 years ago)
Author:
sasha
Comment:

fill is slower than +=

Legend:

Unmodified
Added
Removed
Modified
  • PossibleOptimizationAreas

    v4 v5  
    55  
    66 * Default (digits=0) case of around is 10x slower than {{{(x+0.5).astype(int).astype(float)}}}. Resolved: changeset:2151 implements fast rint function and adds a round method to ndarray that is about as fast for digits=0 case. 
     7  
     8 * As of changeset:2173 {{{x.fill(1)}}} is 2x slower than {{{x += 1}}}.   
     9 
     10{{{ 
     11> python -m timeit -s "from numpy import zeros; x = zeros(10000,'b')" "x.fill(1)" 
     1210000 loops, best of 3: 69.5 usec per loop 
     13> python -m timeit -s "from numpy import zeros; x = zeros(10000,'h')" "x.fill(1)" 
     1410000 loops, best of 3: 66.1 usec per loop 
     15> python -m timeit -s "from numpy import zeros; x = zeros(10000,'i')" "x.fill(1)" 
     1610000 loops, best of 3: 66.3 usec per loop 
     17> python -m timeit -s "from numpy import zeros; x = zeros(10000,'d')" "x.fill(1)" 
     1810000 loops, best of 3: 73.2 usec per loop 
     19}}} 
     20 
     21{{{ 
     22> python -m timeit -s "from numpy import zeros; x = zeros(10000,'b')" "x += 1" 
     2310000 loops, best of 3: 58 usec per loop 
     24> python -m timeit -s "from numpy import zeros; x = zeros(10000,'h')" "x += 1" 
     2510000 loops, best of 3: 33.7 usec per loop 
     26> python -m timeit -s "from numpy import zeros; x = zeros(10000,'i')" "x += 1" 
     2710000 loops, best of 3: 33.6 usec per loop 
     28> python -m timeit -s "from numpy import zeros; x = zeros(10000,'d')" "x += 1" 
     2910000 loops, best of 3: 36.9 usec per loop 
     30}}} 
     31 
     32