| Line | |
|---|
| 1 | notes on optimization points. |
|---|
| 2 | |
|---|
| 3 | * os.path.normpath is slow. |
|---|
| 4 | python -m timeit -s 'x="/usr/lib/portage/bin/dar"; from os.path import normpath' 'normpath(x)' |
|---|
| 5 | 100000 loops, best of 3: 14.1 usec per loop |
|---|
| 6 | |
|---|
| 7 | python -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)' |
|---|
| 9 | 100000 loops, best of 3: 5.62 usec per loop |
|---|
| 10 | |
|---|
| 11 | * os.path.join is a bit slow also, mainly the '/' testing. |
|---|
| 12 | |
|---|
| 13 | Point the two above into pkgcore.util.fs.$FUNC , if/when underlying python is faster, just drop the func and leave the indirection in. |
|---|