Message268951
| Author |
Demur Rumed |
| Recipients |
Demur Rumed |
| Date |
2016年06月21日.01:45:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1466473561.23.0.768330028286.issue27358@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
BUILD_MAP_UNPACK_WITH_CALL is _really_ slow, wasting much of its time asserting that keys are non overlapping. This patch optimizes a fast path for distinct dicts, especially useful for #27213 where BUILD_MAP_UNPACK_WITH_CALL is generated for a single **kw rather than needing **kw1,**kw2 to hit this slow opcode
This patch tracks size of dictionary, if size doesn't increase by same size as the dict we updated sum with, then we scan to find where collision is. Further optimization can be done by scanning size of dicts to preallocate dictionary
Microbenchmark:
from timeit import timeit
def f(**x):return x
timeit(lambda:f(**{'a':2},**{'b':2}))
Unpatched takes ~15s
Patched takes ~5s |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年06月21日 01:46:01 | Demur Rumed | set | recipients:
+ Demur Rumed |
| 2016年06月21日 01:46:01 | Demur Rumed | set | messageid: <1466473561.23.0.768330028286.issue27358@psf.upfronthosting.co.za> |
| 2016年06月21日 01:46:01 | Demur Rumed | link | issue27358 messages |
| 2016年06月21日 01:46:00 | Demur Rumed | create |
|