Message59878
| Author | pitrou |
|---|---|
| Recipients | pitrou |
| Date | 2008-01-14.00:48:19 |
| SpamBayes Score | 0.00685454 |
| Marked as misclassified | No |
| Message-id | <1200271701.23.0.131498543337.issue1819@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
This is a patch for SVN trunk which substantially speeds up function calls with named parameters. It does so by taking into account that parameter names should be interned, so before doing full compares we do a first quick loop to compare pointers. On a microbenchmark the speedup is quite distinctive: # With patch $ ./python -m timeit -s "def f(a,b,c,d,e): pass" "f(1,2,3,4,e=5)" 1000000 loops, best of 3: 0.515 usec per loop $ ./python -m timeit -s "def f(a,b,c,d,e): pass" "f(a=1,b=2,c=3,d=4,e=5)" 1000000 loops, best of 3: 0.652 usec per loop # Without patch $ ./python-orig -m timeit -s "def f(a,b,c,d,e): pass" "f(1,2,3,4,e=5)" 1000000 loops, best of 3: 0.664 usec per loop $ ./python-orig -m timeit -s "def f(a,b,c,d,e): pass" "f(a=1,b=2,c=3,d=4,e=5)" 1000000 loops, best of 3: 1.07 usec per loop |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-01-14 00:48:21 | pitrou | set | spambayes_score: 0.00685454 -> 0.00685454 recipients: + pitrou |
| 2008-01-14 00:48:21 | pitrou | set | spambayes_score: 0.00685454 -> 0.00685454 messageid: <1200271701.23.0.131498543337.issue1819@psf.upfronthosting.co.za> |
| 2008-01-14 00:48:19 | pitrou | link | issue1819 messages |
| 2008-01-14 00:48:19 | pitrou | create | |