On 2/9/2012 7:19 PM, PJ Eby wrote: > Right. It was the part of the post that mentioned that all they sped up > was knowing which directory the files were in, not the actual loading of > bytecode. The thought then occurred to me that this could perhaps be > applied to normal importing, as a zipimport-style speedup. (The > zipimport module caches each zipfile directory it finds on sys.path, so > failed import lookups are extremely fast.) > > It occurs to me, too, that applying the caching trick to *only* the > stdlib directories would still be a win as soon as you have between four > and eight site-packages (or user specific site-packages) imports in an > application, so it might be worth applying unconditionally to > system-defined stdlib (non-site) directories. It might be worthwhile to store a single file in in the directory that contains /Lib with the info inport needs to get files in /Lib and its subdirs, and check that it is not outdated relative to /Lib. Since in Python 3, .pyc files go in __pycache__, if /Lib included an empyty __pycache__ on installation, /Lib would never be touched on most installations. Ditto for the non-__pycache__ subdirs. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4