[issue1819] Speed hack for function calls with named parameters

Antoine Pitrou report at bugs.python.org
Mon Jan 14 02:25:40 CET 2008


Antoine Pitrou added the comment:

Another quick test:

# With patch
$ ./python -m timeit -s "d=dict(a=1,b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0" "f(**d)"
1000000 loops, best of 3: 0.727 usec per loop
$ ./python -m timeit -s "d=dict(b=2,c=3,d=4,e=5);f = lambda a,b,c,d,e:0"
"f(a=1,**d)"
1000000 loops, best of 3: 1.16 usec per loop
$ ./python -m timeit -s "d=dict(b=2,c=3,d=4,e=5); f=lambda **kw:0" "f(**d)"
1000000 loops, best of 3: 0.917 usec per loop

# Without patch
$ ./python-orig -m timeit -s "d=dict(a=1,b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0" "f(**d)"
1000000 loops, best of 3: 1.24 usec per loop
$ ./python-orig -m timeit -s "d=dict(b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0" "f(a=1,**d)"
1000000 loops, best of 3: 1.62 usec per loop
$ ./python-orig -m timeit -s "d=dict(b=2,c=3,d=4,e=5); f=lambda **kw:0"
"f(**d)"
1000000 loops, best of 3: 0.904 usec per loop

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1819>
__________________________________


More information about the Python-bugs-list mailing list