Message183589
| Author |
christian.heimes |
| Recipients |
alex, benjamin.peterson, brett.cannon, christian.heimes, gregory.p.smith, neologix, pitrou, rhettinger, scoder, serhiy.storchaka |
| Date |
2013年03月06日.12:37:16 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1362573437.05.0.906329883469.issue17338@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Gregory, thanks. :)
By the way CPython's list type does more than log(N) resize ops:
$ ./listresize.py 10 100 1000 10000 100000
10 list.append() do 4 resize ops.
100 list.append() do 11 resize ops.
1000 list.append() do 28 resize ops.
10000 list.append() do 47 resize ops.
100000 list.append() do 66 resize ops.
I suspect that hash types (dict, set) could gain even more speed as it eliminates the need for rehashing. It's more costly than memcpy() inside realloc().
I understand the proposal as a power user tool. Most people don't need a pneumatic hammer, an ordinary hammer suffices. But in some cases you need a tool with more power. "CPython doesn't gain much from the new API, let's not add it to Python" isn't nice to other implementations that may benefit from it. |
|