json.dumps: single circle markers hash lookup

Aperta
#161,661 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, python
Ambito
performance

Direzione di ricerca

This is an optimization in the C accelerator for json.dumps, around the circular-reference marker dictionary. Read the encoder path that currently does a contains check followed by a set item, and compare it with the proposed PyDict_SetDefault plus dictionary-size check. The body already links PR gh-161662, so the work is under way and a newcomer should coordinate rather than start fresh. Done means the marker handling uses one dictionary operation and the relevant json tests still pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

extension-modules performance type-feature
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-161662
Lingua principale
Python
Stelle
78.2k
Fork
36.6k
Merge medio
19h 57m
PR unite (30g)
630

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.