classification
Title: Place dict (and values) pointers at a fixed (negative) offset from the base of the object.
Type: performance Stage: patch review
Components: Interpreter Core Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Mark.Shannon Nosy List: Mark.Shannon, kj
Priority: normal Keywords: patch

Created on 2021-12-01 13:30 by Mark.Shannon, last changed 2021-12-07 16:03 by Mark.Shannon.

Pull Requests
URL Status Linked Edit
PR 29879 merged Mark.Shannon, 2021-12-01 14:04
Messages (2)
msg407457 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-12-01 13:30
To get to the dict (or values array) of an object, we currently need 3 dependent loads.
By placing the dict at a fixed offset, this can be reduced to one.

What was `obj[obj->type->dictoffset]` becomes `obj[FIXED_OFFSET]`

See https://github.com/faster-cpython/ideas/issues/80, specifically
https://github.com/faster-cpython/ideas/issues/80#issuecomment-931504847 for more details.
msg407946 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-12-07 16:03
New changeset 8319114feedd2a5b77378bba24eb9fb2689c5033 by Mark Shannon in branch 'main':
bpo-45947: Place dict and values pointer at fixed (negative) offset just before GC header. (GH-29879)
https://github.com/python/cpython/commit/8319114feedd2a5b77378bba24eb9fb2689c5033
History
Date User Action Args
2021-12-07 16:03:03Mark.Shannonsetmessages: + msg407946
2021-12-04 17:31:40kjsetnosy: + kj
2021-12-01 14:04:55Mark.Shannonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28104
2021-12-01 13:30:48Mark.Shannoncreate