Message257814
| Author |
vstinner |
| Recipients |
vstinner |
| Date |
2016年01月09日.09:53:06 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1452333186.64.0.00860839584486.issue26058@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Using timeit to microbenchmark dict operations (constructor, __setitem__, __delitem__, clear), I get exactly the same performance or even better performance (???) with the patch.
./python -m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del d[2]; d.clear()'
Original: 318 ns
Patched: 318 ns
./python -m timeit 'd={i:i for i in range(2**16)}' 'for i in range(2**16): d[i]=i-1' 'for i in range(2**16): d[i]=i+1' 'for i in range(2**15): del d[i]' 'd.clear()'
Original: 19.9 ms
Patched: 18.9 ms (5% faster) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年01月09日 09:53:06 | vstinner | set | recipients:
+ vstinner |
| 2016年01月09日 09:53:06 | vstinner | set | messageid: <1452333186.64.0.00860839584486.issue26058@psf.upfronthosting.co.za> |
| 2016年01月09日 09:53:06 | vstinner | link | issue26058 messages |
| 2016年01月09日 09:53:06 | vstinner | create |
|