Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Remove graph_lock from the _schema_at hot path

Fermée
#128 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Refactorisation
Clarté
À clarifier
Activité
Active
Stack technique
julia
Domaine
performance

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.
Langage dominant
Julia
Étoiles
56
Forks
16
Merge moyen
20 h 1 min
PR mergées (30 j)
14

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de JuliaComputing/OpenAPI.jl

Toutes les issues de JuliaComputing/OpenAPI.jl

Issues similaires

Plus d'issues Julia

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.