A model's parse is still paid cold in every process; the library record cache does not cover it

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

Start with workspace/libs/cache.go and the SourceDocument definition and parsing entry points; compare the library record cache with the model parsing path. The issue leaves two possible designs, so first map how base_model_hash and affected work and how TestIncrementalEqualsFresh tests results. Done means a restart or one-document edit avoids redundant parsing while matching a fresh parse, with bounded eviction and safe cache misses.

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

説明

Disclaimer, this issue was detected and written by an AI

Summary

workspace/libs/cache.go now persists content-addressed IndexRecords for
library documents (name + content hash + set digest + build + format). That
solves the library half of the old ask. The model's own documents are still
parsed cold in every process that opens them: the app, the sysml -render-documents fork and the LSP child each pay the full parse.

Measured on a real 13-document/572 KB set, in-process:

  • cold parse ~2.1 s;
  • the same sources parsed again in the same process: ~3 ms (the service's
    source cache);
  • a one-document edit restarts at ~2 s, even with base_model_hash.

SourceDocument carries only file_path/content/language/name; there is
no content hash for an unchanged document and no warm RPC.

Proposal (pick one, or both)

  1. Per-document content hashes on the wire — add content_sha256 to
    SourceDocument (alongside or instead of inline content). A client that
    holds the model sends hashes for unchanged documents; the service re-reads
    only the changed ones and answers from its content-addressed store. This is
    the smallest change that makes edits cheap.
  2. A warm/persistent model cache — a bounded, content-addressed on-disk cache
    of a whole model's analysis (the InterfaceRecord machinery generalised from
    libraries to a project's documents), or a WarmModel RPC that keeps a model
    resident across processes. Bound it by bytes, with eviction, as
    libs.Cache is.

Keep the existing base_model_hash/affected semantics: a document the service
cannot prove unchanged is affected and re-analyzed.

Tests

  • A two-document model: a hash-only re-parse of unchanged content answers the
    same model hash without re-analysis (the same affected answer as a fresh
    parse).
  • A one-document edit sends one new content and one hash; only that document and
    its dependents are analyzed; the answer equals a fresh parse
    (TestIncrementalEqualsFresh's pattern).
  • Cache eviction and a missing/corrupt entry fall back to a fresh parse.
  • A hash that does not match the content is INVALID_ARGUMENT.

Acceptance

  • A restarting process can open an unchanged model without re-parsing it, or
    a one-document edit re-parses only the changed document.
  • The result always equals a fresh parse; no stale analysis is served.
  • The cache is bounded and evictable; a miss is safe.
主要言語
Go
スター
59
フォーク
20
平均マージ
10時間 23分
マージ済み PR(30日)
897

環境構築

はじめの一歩

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

Open-MBEE/OpenSysML のほかの issue

Open-MBEE/OpenSysML の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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