cpython: b708b3190ecb (original) (raw)

Mercurial > cpython

changeset 105286:b708b3190ecb

Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict Improve speed of dict literal with constant keys up to 30%. [#28731]

INADA Naoki songofacandy@gmail.com
date Tue, 22 Nov 2016 00:57:02 +0900
parents da042eec6743
children 12b4e7209d03
files Misc/NEWS Objects/dictobject.c
diffstat 2 files changed, 22 insertions(+), 5 deletions(-)[+] [-] Misc/NEWS 3 Objects/dictobject.c 24

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1 Core and Builtins ----------------- +- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict.

--- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -389,7 +389,7 @@ dk_set_index(PyDictKeysObject *keys, Py_

/* Alternative fraction that is otherwise close enough to 2n/3 to make

+

+ new_keys = new_keys_object(newsize); if (new_keys == NULL) return NULL;