New submission from Marco Sulla <launchpad.net@marco.sulla.e4ward.com>:
The PR #22948 is an augmented version of #22346. It speeds up also the creation of:
1. dicts from other dicts that are not "perfect" (combined and without holes)
2. fromkeys
3. copies of dicts with many holes
4. dict from keywords, as in #22346
A sample bench:
python -m pyperf timeit --rigorous "dict(o)" -s """
from uuid import uuid4
def getUuid():
return str(uuid4())
o = {getUuid():getUuid() for i in range(1000)}
delkey = getUuid()
o[delkey] = getUuid()
del o[delkey]
"""
.........................................
Before #22948:
Mean +- std dev: 35.9 us +- 0.6 us
After:
Mean +- std dev: 26.4 us +- 0.4 us
----------
messages: 379540
nosy: Marco Sulla
priority: normal
pull_requests: 21865
severity: normal
status: open
title: Speedup various dict inits
_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue42141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
The PR #22948 is an augmented version of #22346. It speeds up also the creation of:
1. dicts from other dicts that are not "perfect" (combined and without holes)
2. fromkeys
3. copies of dicts with many holes
4. dict from keywords, as in #22346
A sample bench:
python -m pyperf timeit --rigorous "dict(o)" -s """
from uuid import uuid4
def getUuid():
return str(uuid4())
o = {getUuid():getUuid() for i in range(1000)}
delkey = getUuid()
o[delkey] = getUuid()
del o[delkey]
"""
.........................................
Before #22948:
Mean +- std dev: 35.9 us +- 0.6 us
After:
Mean +- std dev: 26.4 us +- 0.4 us
----------
messages: 379540
nosy: Marco Sulla
priority: normal
pull_requests: 21865
severity: normal
status: open
title: Speedup various dict inits
_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue42141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com