This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Demur Rumed
Recipients Demur Rumed
Date 2016-06-21.01:45:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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

from timeit import timeit
def f(**x):return x

Unpatched takes ~15s
Patched takes ~5s
Date User Action Args
2016-06-21 01:46:01Demur Rumedsetrecipients: + Demur Rumed
2016-06-21 01:46:01Demur Rumedsetmessageid: <>
2016-06-21 01:46:01Demur Rumedlinkissue27358 messages
2016-06-21 01:46:00Demur Rumedcreate