Skip to content

Reduce padding in the instruction sequence structure #160247

Closed

Description

@ashm-dev

Feature or enhancement

On an x86-64 GCC build, struct instruction_sequence in Include/internal/pycore_instruction_sequence.h occupies 72 bytes.

The following fields introduce two 4-byte alignment gaps: one before s_labelmap and another after s_labelmap_size.

int s_next_free_label;
int *s_labelmap;
int s_labelmap_size;
PyObject *s_nested;

Moving s_labelmap_size immediately before s_labelmap removes both gaps and reduces the structure to 64 bytes.

This would be an internal layout-only change, with no field type or compiler logic changes. The size reduction was verified with a standalone GCC layout check.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added a commit that references this issue on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions