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


Groups > comp.lang.python > #95353

Re: Module load times

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'binary': 0.05; 'problem?': 0.07; 'prototypes': 0.07; 'wrapper': 0.07; '__all__': 0.09; 'caching,': 0.09; 'imports': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'ctype': 0.16; 'dll.': 0.16; 'exported': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'obviously,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; "shouldn't": 0.18; 'stefan': 0.18; 'ctypes': 0.22; 'terminate': 0.22; 'code.': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'used,': 0.27; 'dll': 0.27; 'yield': 0.27; 'function': 0.28; 'command-line': 0.29; 'concern': 0.29; 'classes': 0.30; 'code': 0.30; 'certainly': 0.30; 'class': 0.33; 'this?': 0.34; 'execution': 0.35; 'something': 0.35; 'but': 0.36; 'instead': 0.36; 'tool': 0.36; 'faster': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'things': 0.38; 'times.': 0.38; 'test': 0.39; 'application': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'your': 0.60; 'binding': 0.66; 'one-time': 0.66; 'consumer': 0.67; 'quicker': 0.84; 'quickly?': 0.84; 'subject:times': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: Module load times
Date Thu, 13 Aug 2015 21:12:08 +0200
References <fa960210779145c68a796ae49835c36f@exch.activenetwerx.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host ipservice-092-217-119-042.092.217.pools.vodafone-ip.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <fa960210779145c68a796ae49835c36f@exch.activenetwerx.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.173.1439493144.3627.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1439493143 news.xs4all.nl 2828 [2001:888:2000:d::a6]:41826
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95353

Show key headers only | View raw


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

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


Thread

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

csiph-web