Remove graph_lock from the _schema_at hot path
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 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
- 平均合併
- 22 小時 43 分鐘
- 30 天內合併 PR
- 6
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
JuliaComputing/OpenAPI.jl 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 48/100
JuliaComputing/OpenAPI.jl#113 ·
-
stale
難度 3/5 1-2 天 新手友好度 48/100
JuliaComputing/OpenAPI.jl#87 · 1 則留言 ·
-
stale
難度 4/5 3-5 天 新手友好度 35/100
JuliaComputing/OpenAPI.jl#73 · 4 則留言 ·
-
stale
難度 3/5 1-2 天 新手友好度 45/100
JuliaComputing/OpenAPI.jl#67 · 2 則留言 ·
-
stale
難度 4/5 3-5 天 新手友好度 25/100
JuliaComputing/OpenAPI.jl#65 · 2 則留言 ·
查看 JuliaComputing/OpenAPI.jl 的全部 Issue
相似的 Issue
-
documentation invalid
難度 1/5 1-3 小時 新手友好度 88/100
JuliaPhysics/BeamletOptics.jl#190 ·
維護者通常 2 天內回覆
-
mul! with a Symmetric or Hermitian factor throws for a matrix view whose columns are not contiguous未關閉
難度 2/5 1-3 小時 新手友好度 72/100
JuliaLang/LinearAlgebra.jl#1829 ·
維護者通常 1 天內回覆
-
`EnsembleSummary` `ci_type = :SEM` ribbon is `sqrt(N)` too wide for scalar states可能已有人在做 @isaacsas 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
SciML/SciMLBase.jl#1654 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
rfordatascience/tidytuesday#1098 ·