[issue38219] Optimize dict.__init__ and dict.update for dict argument

2019-09-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38219] Optimize dict.__init__ and dict.update for dict argument

2019-09-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f163aeaa8c15b806b622c9cb10bc1d2a6e034e24 by Serhiy Storchaka in 
branch 'master':
bpo-38219: Optimize dict creating and updating by a dict. (GH-16268)
https://github.com/python/cpython/commit/f163aeaa8c15b806b622c9cb10bc1d2a6e034e24


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38219] Optimize dict.__init__ and dict.update for dict argument

2019-09-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38219] Optimize dict.__init__ and dict.update for dict argument

2019-09-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +15859
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16268

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38219] Optimize dict.__init__ and dict.update for dict argument

2019-09-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

dict.__init__() and dict.update() with a positional argument look up the "keys" 
attribute of the argument to distinguish a mapping from a sequence of 
item-value pairs. It has a non-trivial cost. Merging dicts is optimized for 
exact dicts in PyDict_Merge(), so it would be worth to optimize also this check.

$ ./python -m pyperf timeit -s "d = {}; D = dict" -- "D(d)"
Unpatched:  Mean +- std dev: 154 ns +- 4 ns
Patched:Mean +- std dev: 110 ns +- 4 ns

$ ./python -m pyperf timeit -s "d = {}" -- "d.update(d)"
Unpatched:  Mean +- std dev: 112 ns +- 3 ns
Patched:Mean +- std dev: 70.4 ns +- 1.5 ns

The cost of the check is about 40 ns, and it is a significant part of the total 
time of creating/updating a small dict.

--
components: Interpreter Core
messages: 352753
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize dict.__init__ and dict.update for dict argument
type: performance
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com