Message377318
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)" |
|
Date |
User |
Action |
Args |
2020-09-22 12:56:44 | Marco Sulla | set | recipients:
+ Marco Sulla, methane |
2020-09-22 12:56:44 | Marco Sulla | set | messageid: <1600779404.53.0.758044601526.issue41835@roundup.psfhosted.org> |
2020-09-22 12:56:44 | Marco Sulla | link | issue41835 messages |
2020-09-22 12:56:44 | Marco Sulla | create | |
|