Remove graph_lock from the _schema_at hot path
メンテナーはふだん 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaComputing/OpenAPI.jl のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaComputing/OpenAPI.jl#118 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
JuliaComputing/OpenAPI.jl#117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
JuliaComputing/OpenAPI.jl#113 ·
メンテナーはふだん 1 日以内に返信
-
stale
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
JuliaComputing/OpenAPI.jl#87 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
stale
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaComputing/OpenAPI.jl#73 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
JuliaComputing/OpenAPI.jl の issue をすべて見る
似ている issue
-
`enzymexla.linalg.lu` lowering fails for a tall matrix: the permutation is built with the pivot typeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
EnzymeAD/Enzyme-JAX#3286 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
SciML/LinearSolve.jl#1359 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
EnzymeAD/ReactantNitro.jl#13 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信