Skip to content

Commit 230d8ee

Browse files
jeswrclaude
andcommitted
perf: Extend the JSON-LD fast path to config documents
The initial fast path only covered generator-produced component documents; hand-written config documents always fell back to the generic streaming pipeline, which re-resolves type-scoped contexts for every typed node. Profiling a Community Solid Server cold start showed those per-node scoped-context activations (1,405 distinct resolutions, none repeating within a boot) as the dominant remaining parse cost. This extends the guarded subset with the two features config documents use: - Root-level @graph, including the named-graph form (a root node carrying properties such as `import` alongside @graph names the graph after itself; list cells always land in the default graph, exactly mirroring the generic parser's placement). - Single, non-propagating type-scoped context activation: when a node's @type names a term with a scoped context, that scoped context is resolved ONCE per (context, term) with the real jsonld-context-parser (same options as the generic parser's ParsingContext.parseContext), analyzed, cached on the root entry, and applied to that node only, with nested nodes reverting to the root context (JSON-LD 1.1 non-propagation semantics). Multiple scoped types, propagating or unresolvable scoped contexts, and scoped terms used as keys still fall back. Also fixes double list wrapping for explicit @list objects under @container: @list definitions (previously such documents fell back before reaching the converter, so the case was latent). Correctness: on the full Community Solid Server 7.1.9 boot corpus (828 component documents + 220 config documents), fast-path output is rdf-isomorphic to the generic pipeline for all 1048 files on BOTH the current dependency stack and the componentsjs 5.5.1 stack CSS actually boots with; 1047/1048 take the fast path (the one holdout uses a base-relative @type, which the fast path deliberately leaves to the generic parser). 30 new unit tests cover the @graph and scoped activation matrices; the suite retains 100% coverage. Performance (pss-solid-test, 2-core shared box, alternating arms, fresh data root per boot; backport of this branch onto the installed componentsjs 5.5.1): CSS cold start drops from a 16.0-17.9 s stock median of 16.9 s to 6.2-6.5 s (median 6.3 s) - 2.67x, with 977/978 boot documents fast-pathed. Combined with the earlier module-state work this brings CSS cold boot to the 4-6 s range targeted by the boot-latency roadmap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent bde12a7 commit 230d8ee

2 files changed

Lines changed: 389 additions & 77 deletions

File tree

0 commit comments

Comments
 (0)