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 nascheme
Recipients Yasser Alshalaan, nascheme, pablogsal, rhettinger, scoder
Date 2019-02-19.18:25:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550600757.71.0.329258669425.issue36012@roundup.psfhosted.org>
In-reply-to
Content
Some profiling using 'perf'.  This is for cpython 63fa1cfece4912110ce3a0ff11fb3ade3ff5e756.

  children      self
  [...]
+   97.27%     0.00%  run_mod (inlined)
+   88.53%     6.33%  PyObject_SetAttr
+   79.34%     6.80%  type_setattro
+   43.92%    43.92%  update_slot
+   26.87%     5.84%  _PyObject_GenericSetAttrWithDict
+   14.62%     6.52%  insertdict
+    8.80%     8.80%  lookdict_unicode_nodummy
+    6.57%     0.00%  _Py_DECREF (inlined)
+    5.19%     5.19%  PyUnicode_InternInPlace
+    3.57%     3.57%  _PyObjectDict_SetItem
+    3.38%     3.38%  _PyType_Lookup
+    1.71%     0.00%  _Py_INCREF (inlined)
+    1.42%     0.00%  _Py_XDECREF (inlined)
  [...]

After applying PR 11907:

  children      self
  [...]
+   94.76%     0.00%  run_mod (inlined)
+   75.22%     6.77%  PyObject_SetAttr
+   64.65%    13.08%  type_setattro
+   47.51%    11.96%  _PyObject_GenericSetAttrWithDict
+   22.99%    13.95%  insertdict
+   10.10%    10.10%  lookdict_unicode_nodummy
+    9.47%     9.47%  PyUnicode_InternInPlace
+    7.10%     7.10%  _PyObjectDict_SetItem
+    7.02%     7.02%  _PyType_Lookup
+    6.52%     0.00%  _Py_DECREF (inlined)
+    3.17%     0.00%  _Py_INCREF (inlined)
+    3.16%     0.00%  _Py_XDECREF (inlined)
+    2.59%     0.00%  PyDict_SetItem (inlined)
+    1.50%     0.00%  is_dunder_name (inlined)
  [...]

The PyUnicode_InternInPlace() can mostly be eliminated by testing PyUnicode_CHECK_INTERNED() first (we already have called PyUnicode_Check() on it).  That only gives a 7% speedup on my machine though.  The is_dunder_name() is a much bigger optimization.
History
Date User Action Args
2019-02-19 18:25:57naschemesetrecipients: + nascheme, rhettinger, scoder, pablogsal, Yasser Alshalaan
2019-02-19 18:25:57naschemesetmessageid: <1550600757.71.0.329258669425.issue36012@roundup.psfhosted.org>
2019-02-19 18:25:57naschemelinkissue36012 messages
2019-02-19 18:25:57naschemecreate