Skip to content

Build tuples in a single allocation - #3070

Merged
mzagozen merged 1 commit into
mainfrom
tuple-single-allocation
Aug 20, 2026
Merged

Build tuples in a single allocation#3070
mzagozen merged 1 commit into
mainfrom
tuple-single-allocation

Conversation

@mzagozen

Copy link
Copy Markdown
Collaborator

Do not re-allocate memory for the components field in B_tupleD___init__. Instead make the components field (tail of struct) a flexible array member. This halves the memory usage for constructing tuples.

Do not reallocate memory for the components field in B_tupleD___init__.
Instead make the components field (tail of struct) a flexible array member.
This halves the memory usage for constructing tuples.
@mzagozen
mzagozen force-pushed the tuple-single-allocation branch from 994799f to 6e8b6f1 Compare August 20, 2026 06:30
@mzagozen
mzagozen enabled auto-merge August 20, 2026 06:30
@mzagozen
mzagozen merged commit 69bc98a into main Aug 20, 2026
49 checks passed
@mzagozen
mzagozen deleted the tuple-single-allocation branch August 20, 2026 06:59
@plajjan

plajjan commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

LGTM :)

I have been trying to think whether there is a potential issue about the box of boxed objects being of variable size. Should be fine as-is. It is conceivable we could put a box on the stack and perhaps that would be harder, but I don't think that is very appealing anyway.

@nordlander you saw this, right?

@nordlander

Copy link
Copy Markdown
Contributor

Yup, this is ok with me. It might even have been my original intention!😉

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.

3 participants