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 — json.dumps: single circle markers hash lookup · Issue #161661 · python/cpython

json.dumps: single circle markers hash lookup #161661

New issue
Copy link
New issue
Copy link
Open
Open
json.dumps: single circle markers hash lookup#161661
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

Description

@aivarsk
aivarsk
opened on Nov 9, 2026
Issue body actions

Feature or enhancement

Right now the code does Contains + SetItem for circular reference checks. That can be done as a single hash lookup with PyDict_SetDefault and checking the dictionary size (memory read).

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-161661: json.dumps use a single dict probe for circular-reference markers #161662

Activity

  1. aivarsk
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Nov 9, 2026
  2. picnixz commented on Nov 9, 2026

    @picnixz
    picnixz
    on Nov 9, 2026
    Member
    More actions

    How much perf do we gain?

  3. aivarsk commented on Nov 9, 2026

    @aivarsk
    aivarsk
    on Nov 9, 2026
    ContributorAuthor
    More actions

    Updated to PyDict_SetDefaultRef for a cleaner approach. On a synthetic case with a lot of containers it gives me ~4.5% improvement. For pyperformance it's insignificant 0.x% change.
    Now with SetDefaultRef I think it's also a cleaner code regardless of perf gains or not.

  4. aisk
    added
    performancePerformance or resource usagePerformance or resource usage
    on Nov 9, 2026
  5. aisk
    added this to JSON issueson Nov 9, 2026
  6. aisk
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Nov 9, 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

    extension-modulesC modules in the Modules dirC modules in the Modules dirperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • JSON issues
      Status
      No status
      Show more project fields

    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.