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 Marco Sulla
Recipients Marco Sulla, methane
Date 2020-09-22.12:56:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600779404.53.0.758044601526.issue41835@roundup.psfhosted.org>
In-reply-to
Content
I've done a PR that speeds up the vectorcall creation of a dict using keyword arguments. The PR in practice creates a insertdict_init(), a specialized version of insertdict. I quote the comment to the function:

Same to insertdict but specialized for inserting without resizing and for dict that are populated in a loop and was empty before (see the empty arg).
Note that resizing must be done before calling this function. If not 
possible, use insertdict(). Furthermore, ma_version_tag is left unchanged, you have to change it after calling this function (probably at the end of a loop).

This change speeds up the code up to a 30%. Tested with:

python -m timeit -n 2000  --setup "from uuid import uuid4 ; o =
{str(uuid4()).replace('-', '') : str(uuid4()).replace('-', '') for i
in range(10000)}" "dict(**o)"
History
Date User Action Args
2020-09-22 12:56:44Marco Sullasetrecipients: + Marco Sulla, methane
2020-09-22 12:56:44Marco Sullasetmessageid: <1600779404.53.0.758044601526.issue41835@roundup.psfhosted.org>
2020-09-22 12:56:44Marco Sullalinkissue41835 messages
2020-09-22 12:56:44Marco Sullacreate