Changes between Version 2 and Version 3 of Development/Profiling
- Timestamp:
- 01/20/2013 01:10:25 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Development/Profiling
v2 v3 1 [[PageOutline(1-3,,inline)]] 2 1 3 = Profiling = 2 4 … … 156 158 Also, line 418 (previously 417) uses 400ms instead of 10 seconds in the original code. Most importantly the line is now executed only 2162 times, and not 34592 times as it used to be. Including the the new if-test, the new code uses 560ms compared to 10 seconds in the old. 157 159 The reason this is faster can be seen when comparing the time it takes to execute each of the lines one time. The if-test takes 4.4 microseconds on average, while setting the row value to True takes 189 microseconds. 160 161 === cProfile and Run Snake Run revisited === 162 163 Lets do a new profile with the changes to the code: 164 {{{ 165 python -m cProfile -o deluge.profile deluge -l deluge.log -L info 166 }}} 167 168 [[Image(Deluge_runsnake_after_optimizations.png)]] 169 170 We can now see how update_view has dropped significantly on the list. Each call to update_view now takes 0.37 seconds on average compared to 1.18 in the original code.