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


Groups > comp.lang.python > #95353 > unrolled thread

Re: Module load times

Started byStefan Behnel <stefan_ml@behnel.de>
First post2015-08-13 21:12 +0200
Last post2015-08-13 21:12 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Module load times Stefan Behnel <stefan_ml@behnel.de> - 2015-08-13 21:12 +0200

#95353 — Re: Module load times

FromStefan Behnel <stefan_ml@behnel.de>
Date2015-08-13 21:12 +0200
SubjectRe: Module load times
Message-ID<mailman.173.1439493144.3627.python-list@python.org>
Joseph L. Casale schrieb am 13.08.2015 um 18:56:
> I have an auto generated module that provides functions exported from a
> c dll. Its rather large and we are considering some dynamic code generation
> and caching, however before I embark on that I want to test import times.
> 
> As the module is all auto generated through XSL, things like __all__ are not
> used,  a consumer only imports one class which has methods for their use.
> 
> It is the internal supporting classes which are large such as the ctype function
> prototypes and structures.

How is the DLL binding implemented? Using "ctypes"? Or something else?

Obviously, instantiating a large ctypes wrapper will take some time. A
binary module would certainly be quicker here, both in terms of import time
and execution time. Since you're generating the code anyway, generating
Cython code instead shouldn't be difficult but would certainly yield faster
code.


> My concern is simply reloading this in Python 3.3+ in a timeit loop is not
> accurate. What is the best way to do this?

What makes you think the import might be a problem? That's a one-time
thing. Or is your application a command-line tool or so that needs to start
and terminate quickly?

Stefan

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web