Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83706
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jbaptiste.braun@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.067 |
| X-Spam-Evidence | '*H*': 0.87; '*S*': 0.00; 'exec': 0.09; 'imply': 0.09; 'python': 0.11; '->': 0.16; '10000000': 0.16; 'subject:skip:e 10': 0.16; 'creating': 0.23; "i've": 0.25; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; '100000': 0.31; 'maybe': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'executing': 0.36; 'done': 0.36; 'hi,': 0.36; 'should': 0.36; 'seconds': 0.37; 'performance': 0.37; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'such': 0.63; 'more': 0.64; 'works)': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=hyN1hYlujyt6lUFzeW2EW6CWgvJSqCitATHDbd4z6Kg=; b=l0lGWqIOyeW+bZnVUWHa+7KK5CDCT5cJ//2JT7e8nQoHjB9tlhH7timAVfiA/0Lp41 qDCwe0mQNuORqj7+h0ffQjaAIiHYYwZzhO7NnVi/iqsHVfo6ezq4mW3AauTsDRpfPBNw Ax3TmgLXVGkQHVLK3CVWVJKD1w3r6OakgGKSro+8Vb3MNsyLH4IfhcbwFhQFJqDmqiCU UAy0XrjPCkMn8QDXpHj+ju4uivGHxBGO7Iu5+9l6YzOjrHiBUrteb8NcThtztverEJD6 ddNEKqBjvEC/Ksy2VyVTA+Stgc8i1MzQAoWFydfpa38n2W7SpHSUr6YukZXVBx29VhLB IySw== |
| MIME-Version | 1.0 |
| X-Received | by 10.194.88.131 with SMTP id bg3mr42135504wjb.99.1421168537257; Tue, 13 Jan 2015 09:02:17 -0800 (PST) |
| Date | Tue, 13 Jan 2015 18:02:17 +0100 |
| Subject | Performance in exec environnements |
| From | Jean-Baptiste Braun <jbaptiste.braun@gmail.com> |
| To | python-list@python.org |
| Content-Type | multipart/alternative; boundary=089e010d849ed44b33050c8b95f7 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.17684.1421168544.18130.python-list@python.org> (permalink) |
| Lines | 51 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1421168544 news.xs4all.nl 2870 [2001:888:2000:d::a6]:35179 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83706 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi,
I'm working on auto-generated python code with the exec function. I've done
some performance benches :
% python -m timeit '1 + 1'
10000000 loops, best of 3: 0.0229 usec per loop
% python -m timeit "exec('1 + 1')"
100000 loops, best of 3: 11.6 usec per loop
-> Maybe creating an exec environnement (I don't know how it works) takes
time. But :
% python -m timeit "1 + 1; 1 + 1"
10000000 loops, best of 3: 0.042 usec per loop
% python -m timeit "exec('1 + 1; 1 + 1')"
100000 loops, best of 3: 15.7 usec per loop
-> As if executing one more 1 + 1 would take 4 more seconds (100000
iterations) in an exec environnement.
Am I missing something or should I expect that result ? What does using
exec imply that causes such a difference ?
Jean-Baptiste Braun
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Performance in exec environnements Jean-Baptiste Braun <jbaptiste.braun@gmail.com> - 2015-01-13 18:02 +0100
Re: Performance in exec environnements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-14 08:48 +1100
Re: Performance in exec environnements Jean-Baptiste Braun <jbaptiste.braun@gmail.com> - 2015-01-14 10:02 +0100
Re: Performance in exec environnements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-15 12:51 +1100
Re: Performance in exec environnements Chris Angelico <rosuav@gmail.com> - 2015-01-14 22:14 +1100
Re: Performance in exec environnements Jean-Baptiste Braun <jbaptiste.braun@gmail.com> - 2015-01-14 14:38 +0100
Re: Performance in exec environnements Chris Angelico <rosuav@gmail.com> - 2015-01-15 00:43 +1100
Re: Performance in exec environnements Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-14 10:11 -0700
csiph-web