Message279655
If you inline insert_index, dictresize3 is not that bad.
./python3 -m perf timeit -s 'x = list(range(1000))' -- 'dict.fromkeys(x)'
dictresize3: Median +- std dev: 43.9 us +- 0.7 us
dictresize3(insert_index inlined): Median +- std dev: 41.6 us +- 0.6 us
dictresize4: Median +- std dev: 41.7 us +- 1.2 us
But don't bother on microbenchmark, just move on. I just think the logic is not as clear as dictresize3. But the easiness for future modification makes sense. |
|
Date |
User |
Action |
Args |
2016-10-29 06:14:00 | xiang.zhang | set | recipients:
+ xiang.zhang, rhettinger, vstinner, methane, serhiy.storchaka |
2016-10-29 06:14:00 | xiang.zhang | set | messageid: <1477721640.73.0.798391842129.issue28199@psf.upfronthosting.co.za> |
2016-10-29 06:14:00 | xiang.zhang | link | issue28199 messages |
2016-10-29 06:14:00 | xiang.zhang | create | |
|