Message335733
It seems 50% of the overhead (50ns) is due to two reasons:
- 30-40% is due to the call to update_slot(type, name) after the item is set in the class dictionary.
- 70-60% is due to all the extra work from _PyObject_GenericSetAttrWithDict until it ends calling _PyObjectDict_SetItem with the slot. If in the code of typeobject.c:type_setattro you change:
res = _PyObject_GenericSetAttrWithDict((PyObject *)type, name, value, NULL);
by
PyObject* dictptr = _PyObject_GetDictPtr(type);
res = _PyObjectDict_SetItem(type, dictptr, name, value);
and delete the update_slot(type, name) call afterwards, the times are reduced to 50ns. |
|
Date |
User |
Action |
Args |
2019-02-16 23:34:44 | pablogsal | set | recipients:
+ pablogsal, nascheme, rhettinger, vstinner |
2019-02-16 23:34:44 | pablogsal | set | messageid: <1550360084.44.0.674129423506.issue36012@roundup.psfhosted.org> |
2019-02-16 23:34:44 | pablogsal | link | issue36012 messages |
2019-02-16 23:34:44 | pablogsal | create | |
|