root/releases/pkgcore/0.2.1/dev-notes/optimizations.rst @ marienz%2540gentoo.org-20061102043522-368fe7436ef174cf

Revision marienz%2540gentoo.org-20061102043522-368fe7436ef174cf, 0.7 KB (checked in by Marien Zwart <marienz@…>, 2 years ago)

rst-ify a bunch of dev-notes.

Line 
1===============
2 Optimizations
3===============
4
5notes on optimization points.
6
7* os.path.normpath is slow::
8
9   python -m timeit -s 'x="/usr/lib/portage/bin/dar"; \
10     from os.path import normpath' 'normpath(x)'
11   100000 loops, best of 3: 14.1 usec per loop
12
13   python -m timeit -s 'x="/usr/lib/portage/bin/dar";from os.path import sep; \
14     normpath=lambda x:sep.join(filter(None, x.split(sep)))' \
15     'normpath(x)'
16   100000 loops, best of 3: 5.62 usec per loop
17* os.path.join is a bit slow also, mainly the '/' testing.
18
19Point the two above into pkgcore.util.fs.$FUNC , if/when underlying
20python is faster, just drop the func and leave the indirection in.
Note: See TracBrowser for help on using the browser.