[Python-3000] Using a list for *args (was: Type annotations: annotating generators)

Collin Winter collinw at gmail.com
Thu Jun 1 21:32:39 CEST 2006


On 6/1/06, Neal Norwitz <nnorwitz at gmail.com> wrote:
> Could you run a benchmark before and after this patch?  I'd like to
> know speed diff.

(Sorry you got this twice, Neal.)

I've attached the benchmarks as a comment on the patch, but I'll
repeat them here. All times are usecs per loop.

./python -mtimeit 'def foo(*args): pass' 'foo()'
As tuple: 1.56
As list:  1.7

./python -mtimeit 'def foo(*args): pass' 'foo(1)'
As tuple: 1.75
As list:  2.04

./python -mtimeit 'def foo(*args): pass' 'foo(1, 2)'
As tuple: 1.87
As list:  2.15

./python -mtimeit 'def foo(*args): pass' 'foo(1, 2, 3)'
As tuple: 1.95
As list:  2.3

./python -mtimeit 'def foo(*args): pass' 'foo(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)'
As tuple: 2.67
As list:  2.97

Collin Winter


More information about the Python-3000 mailing list