Changes between Version 5 and Version 6 of PossibleOptimizationAreas
- Timestamp:
- 02/27/06 17:47:47 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PossibleOptimizationAreas
v5 v6 6 6 * 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 7 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. 9 9 10 10 {{{ … … 18 18 10000 loops, best of 3: 73.2 usec per loop 19 19 }}} 20 21 20 {{{ 22 21 > python -m timeit -s "from numpy import zeros; x = zeros(10000,'b')" "x += 1" … … 29 28 10000 loops, best of 3: 36.9 usec per loop 30 29 }}} 31 32 30 The [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)" 33 100000 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)" 35 100000 loops, best of 3: 12 usec per loop 36 > python -m timeit -s "from numpy import zeros; x = zeros(10000,'i')" "x.fill(1)" 37 100000 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)" 39 100000 loops, best of 3: 13 usec per loop 40 }}} 41 Note the more than 10x improvement in the 'b' case.
