Macro and micro performance tuning
March 21st, 2005 at 8:32 am (3 years, 3 months ago) by Andi Vajda under chandlerdbThe focus of the repository work for Chandler’s 0.5 release was mostly about startup and commit performance. The approach taken was to run these operations in the hotshot profiler to find out more about the slow areas and rework them. This macro-performance effort can yield useful results. For instance, commit was made twice as fast by rewriting it to not use any XML.
For 0.6, I’d like to also look at performance at the micro-level.
This module allows to time small snippets of code and compare how they perform. It makes optimization by trial and error really easy.
For example, running these two statements on the command line
- python -m timeit -s “a={}” “0 in a”
- python -m timeit -s “a={}” “a.haskey(0)”
shows that the ‘in’ operator can be quite a bit faster than haskey(), its functional equivalent.
By using these techniques and moving some well chosen code to C, simple repository attribute access is now over four times faster.








