Skip to content

[Performance > Runtime]: Optimize CLI and tool hot paths - #7

Merged
rendotdev merged 1 commit into
mainfrom
perf/optimize-runtime-hot-paths
Jul 24, 2026
Merged

rendotdev merged 1 commit into
mainfrom
perf/optimize-runtime-hot-paths

Conversation

@rendotdev

Copy link
Copy Markdown
Owner

Summary

At the moment, routine Rig commands load public API dependencies, eagerly initialize collections, repeatedly evaluate tool metadata, and perform synchronous work in search and logging hot paths.

This PR reduces CLI startup and runtime overhead while preserving the existing public compatibility entrypoint.

  • adds a minimal dist/bin.mjs executable while retaining dist/rig.mjs exports
  • lazily initializes collections and caches periodic integrity checks
  • persists serialized tool metadata and avoids loading tool environment values for metadata commands
  • memoizes fuzzy-search comparisons and uses rolling edit-distance buffers
  • resolves named tools directly and caches nested commands within an execution session
  • batches structured log writes while preserving rotation behavior
  • expands Bun and Node benchmarks with scale scenarios and p50 budgets

Measured locally:

  • config path: approximately 58 ms to 31 ms
  • search across 1,000 documents: approximately 170 ms to 23 ms
  • search across 5,000 documents: approximately 887 ms to 133 ms
  • 10,000 structured log records: approximately 209 ms to 13 ms
  • cached listing across 105 tools: approximately 45 ms

Validation

  • vp run ci
  • 227 unit tests with 100% coverage
  • 30 end-to-end tests
  • smoke and package checks
  • Bun and Node benchmark suites

@rendotdev
rendotdev merged commit 5e4bfc1 into main Jul 24, 2026
1 check 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.

1 participant