[Python-Dev] updated imputil
Greg Stein
gstein@lyra.org
Sat, 20 Nov 1999 04:11:37 -0800 (PST)
oops... forgot:
http://www.lyra.org/greg/python/imputil.py
-g
On Sat, 20 Nov 1999, Greg Stein wrote:
> I've updated imputil... The main changes is that I added SysPathImporter
> and BuiltinImporter. I also did some restructing to help with
> bootstrapping the module (remove dependence on os.py).
>
> For testing a revamped Python import system, you can importing the thing
> and call imputil._test_revamp() to set it up. This will load normal,
> builtin, and frozen modules via imputil. Dynamic modules are still
> handled by Python, however.
>
> I ran a timing comparisons of importing all modules in /usr/lib/python1.5
> (using standard and imputil-based importing). The standard mechanism can
> do it in about 8.8 seconds. Through imputil, it does it in about 13.0
> seconds. Note that I haven't profiled/optimized any of the Importer stuff
> (yet).
>
> The point about dynamic modules actually discovered a basic problem that I
> need to resolve now. The current imputil assumes that if a particular
> Importer loaded the top-level module in a package, then that Importer is
> responsible for loading all other modules within that package. In my
> particular test, I tried to import "xml.parsers.pyexpat". The two package
> modules were handled by SysPathImporter. The pyexpat module is a dynamic
> load module, so it is *not* handled by the Importer -- bam. Failure.
>
> Basically, each part of "xml.parsers.pyexpat" may need to use a different
> Importer...
>
> Off to ponder,
> -g
>
> --
> Greg Stein, http://www.lyra.org/
>
>
> _______________________________________________
> Python-Dev maillist - Python-Dev@python.org
> http://www.python.org/mailman/listinfo/python-dev
>
--
Greg Stein, http://www.lyra.org/