Message183545
| Author |
christian.heimes |
| Recipients |
alex, benjamin.peterson, brett.cannon, christian.heimes, pitrou, rhettinger, serhiy.storchaka |
| Date |
2013年03月05日.18:53:34 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1362509615.11.0.898720848367.issue17338@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Here is an experimental patch. The speedup is ... measurable.
$ ./python -m timeit -n1000 "l = []" "l.__preallocate__(10000)" "app = l.append" "for i in range(10000): app(i)" "l.__shrink__()"
1000 loops, best of 3: 3.68 msec per loop
$ ./python -m timeit -n1000 "l = []" "app = l.append" "for i in range(10000): app(i)"
1000 loops, best of 3: 3.75 msec per loop |
|