Title: Generalize the use of _Py_IDENTIFIER in ceval.c and typeobject.c
Type: performance Stage:
Components: Interpreter Core Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, loewis, pitrou, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2012-03-22 01:08 by vstinner, last changed 2012-03-26 20:19 by vstinner. This issue is now closed.

File name Uploaded Description Edit
identifier.patch vstinner, 2012-03-22 01:11 review
Messages (3)
msg156529 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-03-22 01:08
Attached patch adds the followig functions:
 - _PyDict_GetItemId()
 - _PyDict_SetItemId()
 - _PyType_LookupId() (private)

And it uses identifiers in ceval.c and typeobject.c where it is revelant.

I expect a small speedup.

The patch does also simplify the code: use the new identifier API instead of an explicit static keyword and call to PyUnicode_InternXXX.

I can split the patch into smaller parts if you prefer.
msg156532 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-03-22 01:11
Oops, my patch contained an unrelated change. I attach a new patch. I commited the change:

changeset:   75866:
tag:         tip
user:        Victor Stinner <>
date:        Thu Mar 22 02:09:08 2012 +0100
files:       Objects/object.c
Micro-optimize PyObject_GetAttrString()
msg156865 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-26 20:15
New changeset c67f3681e032 by Victor Stinner in branch 'default':
Issue #14383: Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
Date User Action Args
2012-03-26 20:19:19vstinnersetstatus: open -> closed
resolution: fixed
2012-03-26 20:15:41python-devsetnosy: + python-dev
messages: + msg156865
2012-03-22 01:11:25vstinnersetfiles: + identifier.patch

messages: + msg156532
2012-03-22 01:10:01vstinnersetfiles: - identifier.patch
2012-03-22 01:09:15pitrousetnosy: + benjamin.peterson
2012-03-22 01:08:10vstinnercreate