Message153566
| Author |
pitrou |
| Recipients |
brett.cannon, pitrou |
| Date |
2012年02月17日.16:38:25 |
| SpamBayes Score |
2.2499766e-09 |
| Marked as misclassified |
No |
| Message-id |
<1329496708.57.0.639882345046.issue14043@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This patch makes importlib's _FileFinder more than 10x faster by keeping a cache of directory entries. It's actually faster than imp.find_module()!
-> imp.find_module:
$ ./python -m timeit -s "import imp" "imp.find_module('logging', None)"
10000 loops, best of 3: 69.9 usec per loop
$ ./python -m timeit -s "import imp" "imp.find_module('bisect', None)"
10000 loops, best of 3: 108 usec per loop
-> unpatched importlib:
$ ./python -m timeit -s "from importlib._bootstrap import _DefaultPathFinder as Finder" "Finder.find_module('logging', None)"
1000 loops, best of 3: 431 usec per loop
$ ./python -m timeit -s "from importlib._bootstrap import _DefaultPathFinder as Finder" "Finder.find_module('bisect', None)"
1000 loops, best of 3: 468 usec per loop
-> patched importlib:
$ ./python -m timeit -s "from importlib._bootstrap import _DefaultPathFinder as Finder" "Finder.find_module('logging', None)"
10000 loops, best of 3: 37.5 usec per loop
$ ./python -m timeit -s "from importlib._bootstrap import _DefaultPathFinder as Finder" "Finder.find_module('bisect', None)"
10000 loops, best of 3: 36.9 usec per loop |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年02月17日 16:38:28 | pitrou | set | recipients:
+ pitrou, brett.cannon |
| 2012年02月17日 16:38:28 | pitrou | set | messageid: <1329496708.57.0.639882345046.issue14043@psf.upfronthosting.co.za> |
| 2012年02月17日 16:38:26 | pitrou | link | issue14043 messages |
| 2012年02月17日 16:38:26 | pitrou | create |
|