Path: csiph.com!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'cached': 0.09; 'imports': 0.09; 'instantiated': 0.09; 'slow.': 0.09; 'python': 0.10; 'times,': 0.13; 'importing': 0.15; 'interpreter': 0.15; 'subsequent': 0.15; '(relatively': 0.16; 'clear.': 0.16; 'ctype': 0.16; 'manifest': 0.16; 'prototypes,': 0.16; 'received:172.18.0': 0.16; 'to:addr:pearwood.info': 0.16; 'module,': 0.18; 'version.': 0.18; 'tests': 0.18; 'runs': 0.18; 'developer': 0.20; 'to:name :python-list@python.org': 0.20; 'to:2**1': 0.21; 'trying': 0.22; 'bit': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'separate': 0.27; 'disk': 0.27; 'function': 0.28; 'starts': 0.29; 'code': 0.30; 'steven': 0.33; 'fresh': 0.35; 'quite': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'modules': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'charset:us-ascii': 0.37; 'mean': 0.38; 'why': 0.39; 'test': 0.39; 'application': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'side': 0.62; 'matter.': 0.66; 'results.': 0.67; 'validate': 0.76; '100': 0.79; 'harness': 0.84; 'launches': 0.84; 'plugin.': 0.84; 'plugins': 0.84; 'subject:times': 0.84; 'processes,': 0.93 X-Authority-Analysis: v=2.1 cv=T55GNa+Q c=1 sm=1 tr=0 a=g3mLq75WYuDrh3Lt0JSDww==:117 a=g3mLq75WYuDrh3Lt0JSDww==:17 a=QC7fh9NfAAAA:8 a=dmF8UoGEAYUA:10 a=kj9zAlcOel0A:10 a=uRRa74qj2VoA:10 a=xlvznIEjurYIerYxbNMA:9 a=CjuIK1q_8ugA:10 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.activenetwerx.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.0 From: "Joseph L. Casale" To: 'Steven D'Aprano' , "python-list@python.org" Subject: RE: Module load times Thread-Topic: Module load times Thread-Index: AQHQ1ej8wFn1zD8Vfk6np2iCbXgpwp4KsKgAgAAR9gGAAAFA0A== Date: Fri, 14 Aug 2015 02:25:29 +0000 References: <55cd4e0c$0$1642$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <55cd4e0c$0$1642$c3e8da3$5496439d@news.astraweb.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.18.0.209] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CMAE-Envelope: MS4wfPRbEeHdElLyzs0vbpFSnMgledbL006KyOIoFZdPCjZEdfy75jJ68kDuJsI2Ijcjibdqwm80x/Dab9nemfX6GVpIuHsnONmMiRLGGB1+S4e0yl2J9jq3uk86htgcaC8yuCuiGxsw5upO7vXdwkoaD1+vAJFRBUsVarRmPKsIRR/ekmW9Nso8+/JEUTTAt1p5rA== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439519432 news.xs4all.nl 2956 [2001:888:2000:d::a6]:57220 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95366 > Importing is not the same as instantiation. > > When you import a module, the code is only read from disk and instantiate= d > 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 f= or > 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, th= en > 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 proces= ses and hence modules with import side effects or simply large modules can manifest over time. Thanks Steven jlc