GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reduce padding in parser memo entries · Issue #160245 · python/cpython

Reduce padding in parser memo entries #160245

New issue
Copy link
New issue
Copy link
Closed
#160266
Closed
Reduce padding in parser memo entries#160245
#160266
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-parsertype-featureA feature request or enhancementA feature request or enhancement

Description

@ashm-dev
ashm-dev
opened on Oct 22, 2026
Issue body actions

Feature or enhancement

On an x86-64 GCC build, Memo in Parser/pegen.h occupies 32 bytes. Its current field order is:

int type;
void *node;
int mark;
struct _memo *next;

This introduces two 4-byte alignment gaps. Moving mark immediately after type reduces the structure to 24 bytes without changing any field types.

These entries are allocated through _PyArena_Malloc(), which rounds allocations to 8-byte boundaries. The proposed layout therefore saves 8 bytes per entry within the arena.

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

  • gh-160245: Reduce padding in Memo #160266

Activity

  1. ashm-dev
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Oct 22, 2026
  2. aisk
    added
    performancePerformance or resource usagePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-parser
    on Oct 22, 2026
  3. ashm-dev
    added a commit that references this issue on Oct 22, 2026

    Merge branch 'main' into pythongh-160245

    1767bdf
  4. pablogsal
    added a commit that references this issue on Oct 22, 2026

    gh-160245: Reduce padding in the Memo struct in the parser (#160266)

    f65e2a2
  5. pablogsal
    closed this as completedin #160266on Oct 22, 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)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-parsertype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.