Changes between Version 5 and Version 6 of PossibleOptimizationAreas

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

described fast fill patch

Legend:

Unmodified
Added
Removed
Modified
  • PossibleOptimizationAreas

    v5 v6  
    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. 
    77  
    8  * As of changeset:2173 {{{x.fill(1)}}} is 2x slower than {{{x += 1}}}.   
     8 * As of changeset:2173 {{{x.fill(1)}}} is 2x slower than {{{x += 1}}}.  One should be able to set memory to a constant value faster than autoincrement. 
    99 
    1010{{{ 
     
    181810000 loops, best of 3: 73.2 usec per loop 
    1919}}} 
    20  
    2120{{{ 
    2221> python -m timeit -s "from numpy import zeros; x = zeros(10000,'b')" "x += 1" 
     
    292810000 loops, best of 3: 36.9 usec per loop 
    3029}}} 
    31  
    32  
     30The [attachment:fast-fill-patch.txt attached patch] results in the following timings: 
     31{{{ 
     32> python -m timeit -s "from numpy import zeros; x = zeros(10000,'b')" "x.fill(1)" 
     33100000 loops, best of 3: 4.55 usec per loop 
     34> python -m timeit -s "from numpy import zeros; x = zeros(10000,'h')" "x.fill(1)" 
     35100000 loops, best of 3: 12 usec per loop 
     36> python -m timeit -s "from numpy import zeros; x = zeros(10000,'i')" "x.fill(1)" 
     37100000 loops, best of 3: 12.4 usec per loop 
     38> python -m timeit -s "from numpy import zeros; x = zeros(10000,'d')" "x.fill(1)" 
     39100000 loops, best of 3: 13 usec per loop 
     40}}} 
     41Note the more than 10x improvement in the 'b' case.