Performance in exec environnements
ian.g.kelly at gmail.com
Wed Jan 14 18:11:13 CET 2015
On Wed, Jan 14, 2015 at 2:02 AM, Jean-Baptiste Braun
<jbaptiste.braun at gmail.com> wrote:
> What I don't understand is the ratio between test 2 / 4 and test 1 / 3.
> Let 0.0229 sec be the execution time to read a bytecode (1st test).
> Executing two times that bytecode takes 0.042 sec (test 3), which looks
> Let 11.6 sec be the execution time to call the global exec, parse, do some
> stuff and read a bytecode (test 2). I'm trying to understand why does doing
> the same thing and reading one more bytecode is much longer (15.7 sec) in
You've also given it twice as much code to parse and compile.
C:\Users\Ian>python -m timeit "compile('1 + 1', '', 'exec')"
100000 loops, best of 3: 16.8 usec per loop
C:\Users\Ian>python -m timeit "compile('1 + 1; 1 + 1', '', 'exec')"
10000 loops, best of 3: 22.4 usec per loop
More information about the Python-list