From 1c2143bb55f18c081609c8c791be83b42a50c3c1 Mon Sep 17 00:00:00 2001 From: Shamil Abdulaev Date: Thu, 22 Oct 2026 20:32:29 +0300 Subject: [PATCH] perf(compiler): reduce padding in _PyInstructionSequence --- Include/internal/pycore_instruction_sequence.h | 2 +- .../2026-10-22-20-18-44.gh-issue-160247.WC8hRU.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-10-22-20-18-44.gh-issue-160247.WC8hRU.rst diff --git a/Include/internal/pycore_instruction_sequence.h b/Include/internal/pycore_instruction_sequence.h index 6257b771fd9539c..1643776c47ee697 100644 --- a/Include/internal/pycore_instruction_sequence.h +++ b/Include/internal/pycore_instruction_sequence.h @@ -40,8 +40,8 @@ typedef struct instruction_sequence { /* Map of a label id to instruction offset (index into s_instrs). * If s_labelmap is NULL, then each label id is the offset itself. */ - int *s_labelmap; int s_labelmap_size; + int *s_labelmap; /* PyList of instruction sequences of nested functions */ PyObject *s_nested; diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-22-20-18-44.gh-issue-160247.WC8hRU.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-22-20-18-44.gh-issue-160247.WC8hRU.rst new file mode 100644 index 000000000000000..97755e25aac7c26 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-22-20-18-44.gh-issue-160247.WC8hRU.rst @@ -0,0 +1,2 @@ +Reduce padding in the internal instruction sequence structure, saving 8 bytes +per instance on 64-bit platforms. Patch by Shamil Abdulaev.