Skip to content

Cache service-loader lookups for macros and script commands - #13

Merged
wadoon merged 1 commit into
fix/client-test-compilationfrom
fix/server-perf
Jun 22, 2026
Merged

Cache service-loader lookups for macros and script commands#13
wadoon merged 1 commit into
fix/client-test-compilationfrom
fix/server-perf

Conversation

@unp1

@unp1 unp1 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Performance (keyext.api): avoid repeated ServiceLoader classpath scans.

Macros and script commands don't change at runtime, so they're now discovered once at construction: cached lists for the two getAvailable* methods, and a name -> macro map for O(1) lookup in macro().

Dropped from the original review: #16 (treeChildren "O(n) DFS"). On inspection Proof.findAny is itself an O(n) BFS, so the suggested consolidation is no faster, and a custom serial→node index isn't worth the invalidation complexity. No change made there.

Tests: KeyApiServiceCacheTest (macros/commands non-empty and stable; unknown macro name rejected). The caching is structural, so these are no-regression guards rather than fail-on-old-code tests.

Stacked on #7; retarget to main once it merges. Touches only methods none of the other open PRs touch, so no conflicts.

PR has been created with AI tooling

@unp1
unp1 force-pushed the fix/server-perf branch from 1271816 to 1f7f80e Compare June 22, 2026 18:13
@wadoon
wadoon merged commit 6e4d263 into fix/client-test-compilation Jun 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants