Skip to content

[mypyc] Update vec value struct to have direct pointer to items#21420

Open
JukkaL wants to merge 9 commits intomasterfrom
vec-buf-pointer
Open

[mypyc] Update vec value struct to have direct pointer to items#21420
JukkaL wants to merge 9 commits intomasterfrom
vec-buf-pointer

Conversation

@JukkaL
Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL commented May 6, 2026

Now the second field of a vec struct representation points to the first data item. Previously the second field of the vec struct representation was a PyObject * targeting the buffer object. This removes one pointer addition per get item or set item operation. Since these are often the most performance critical operations, we want them to be as efficient as possible. This should reduce the number of instructions at least on ARM, and it will reduce code size on x64 as well.

Since vec is still behind a feature flag, we can still break the ABI.

Used heavy coding agent assist, but iterated until the results look good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant