Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95366

RE: Module load times

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Module load times
Date 2015-08-14 02:25 +0000
References <mqiq69$n8p$1@ger.gmane.org> <mailman.177.1439500385.3627.python-list@python.org> <55cd4e0c$0$1642$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.0.1439519432.4764.python-list@python.org> (permalink)

Show all headers | View raw


> Importing is not the same as instantiation.
>
> When you import a module, the code is only read from disk and instantiated
> the first time. Then it is cached. Subsequent imports in the same Python
> session use the cached version.

I do mean imported, in the original design there were many ctype function
prototypes, the c developer had ran some tests and showed quite a bit of
time taken up just the import over 100 clean imports. I don't have his test
harness and hence why I am trying to validate the results.

> So the answer will depend on your application. If your application runs for
> a long time (relatively speaking), and imports the plugins 100s or 1000s of
> times, it should not matter. Only the first import is likely to be slow.
>
> But if the application starts up, imports the plugin, then shuts down, then
> repeats 100s or 1000s of times, that may be slow. Or if it launches
> separate processes, each of which imports the plugin.

Yeah that wasn't clear. The plugins are invoked in fresh interpreter processes
and hence modules with import side effects or simply large modules can
manifest over time.

Thanks Steven
jlc

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Module load times "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-08-13 21:12 +0000
  Re: Module load times Steven D'Aprano <steve@pearwood.info> - 2015-08-14 12:10 +1000
    RE: Module load times "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-08-14 02:25 +0000
    Re: Module load times Chris Angelico <rosuav@gmail.com> - 2015-08-14 12:38 +1000

csiph-web