| Line | |
|---|
| 1 | =============== |
|---|
| 2 | Optimizations |
|---|
| 3 | =============== |
|---|
| 4 | |
|---|
| 5 | notes 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 | |
|---|
| 19 | Point the two above into pkgcore.util.fs.$FUNC , if/when underlying |
|---|
| 20 | python is faster, just drop the func and leave the indirection in. |
|---|