Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Remove graph_lock from the _schema_at hot path

Aperta
#128 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
julia
Ambito
performance

Direzione di ricerca

Start in src/runtime.jl at _schema_at, then inspect _build_schema_at and the accesses to spec.subschemas and spec.graph_lock. Compare the precomputation and immutable-cache options described in the issue, including their interaction with generated descriptors and concurrent decoders. Done means removing the lock from the lookup hot path without unsafe concurrent Dict reads.

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

Descrizione

Follow-up from #126, raised in review.

_schema_at (src/runtime.jl) now caches subschema views in spec.subschemas, guarded by spec.graph_lock:

cached = lock(() -> get(spec.subschemas, key, nothing), spec.graph_lock)
cached === nothing || return cached
schema = _build_schema_at(spec, descriptor, direction)
lock(() -> (spec.subschemas[key] = schema), spec.graph_lock)

Every lookup takes the lock once, and the first lookup of a key takes it twice. Before #126 this path was lock-free once the graph existed, but it rebuilt the view on every call. Uncontended, the lock costs about 200 ns per call. Under multi-threaded decoding it serializes lookups.

The lock is required: subschemas is a plain Dict written by concurrent decoders, so the read cannot simply drop it.

Options:

  • Precompute views for all known descriptors when the graph is built. Descriptors are per-call-site constants in generated code, so this needs codegen to register them.
  • Keep an immutable cache and swap it atomically on miss. Reads become lock-free, and a miss copies the cache.
Lingua principale
Julia
Stelle
56
Fork
16
Merge medio
1g 51m
PR unite (30g)
12

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 JuliaComputing/OpenAPI.jl

Tutte le issue di JuliaComputing/OpenAPI.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.