Skip to content

Commit 1877a30

Browse files
committed
gh-153234: Add NEWS entry for dict.fromkeys fast-clone optimization
1 parent bed01e8 commit 1877a30

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Optimize :meth:`dict.fromkeys` when the source iterable is a compact combined
2+
dict by cloning the underlying ``PyDictKeysObject`` in a single ``memcpy``
3+
and filling values in one pass, instead of calling ``insertdict()`` for every
4+
key. This avoids O(n) hash lookups and collision probing on the target dict.

0 commit comments

Comments
 (0)