Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Remove graph_lock from the _schema_at hot path

オープン
#128 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
活発
技術スタック
julia
領域
performance

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
Julia
スター
56
フォーク
16
平均マージ
1日 51分
マージ済み PR(30日)
12

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaComputing/OpenAPI.jl のほかの issue

JuliaComputing/OpenAPI.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。