root/releases/pkgcore/0.1.1/dev-notes/optimizations @ marienz%2540gentoo.org-20060314111206-43455e690e5c356b

Revision marienz%2540gentoo.org-20060314111206-43455e690e5c356b, 0.8 KB (checked in by Marien Zwart <marienz@…>, 3 years ago)

Rename portage to pkgcore.

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