Skip to content

perf: optimize parse caching across providers#116

Merged
iamtoruk merged 14 commits intogetagentseal:mainfrom
spMohanty:dev/cache-parse-parse-performance
Apr 20, 2026
Merged

perf: optimize parse caching across providers#116
iamtoruk merged 14 commits intogetagentseal:mainfrom
spMohanty:dev/cache-parse-parse-performance

Conversation

@spMohanty
Copy link
Copy Markdown
Contributor

@spMohanty spMohanty commented Apr 20, 2026

Summary

This PR adds a persistent, provider-agnostic parse cache so repeated runs are fast and avoid reparsing unchanged session data across CLI runs.

What changed

  • Adds a persistent source cache manifest/entries with validator metadata (parser version, fingerprint paths, cache strategy, range metadata).
  • Splits cache handling into two-phase planning + materialization so unchanged sources are fast-pathed.
  • Improves append-style provider handling with tail/offset checks to avoid unnecessary full reparses.
  • Adds provider discovery caching to skip unchanged directory scans.
  • Adds --no-cache support for parse-backed commands to force full rebuild.
  • Adds provider-aware cache progress reporting on stderr.
  • Updates dashboard windowing to reuse cached windows and preload 30days where useful.
  • Adds a small launcher shim (bin/codeburn) to harden global installs.
  • Documents cache behavior in README/CHANGELOG.

Performance Impact

Benchmark command (all runs are separate CLI processes):

CODEBURN_CACHE_DIR=/tmp/codeburn-bench-<id> \
HOME=$HOME \
node --import tsx /tmp/bench-once.mjs <repo_root> all

Using the same cache directory for the repeated warm runs.

  • Upstream baseline (https://github.com/getagentseal/codeburn@e259220, main):

    • cold run (empty cache directory): 45.600s
    • warm run (separate process, same cache directory): 50.606s, 49.515s, 42.975s, 35.827s, 40.916s
  • Current branch (https://github.com/spMohanty/codeburn@7594fa0, dev/cache-parse-parse-performance):

    • cold run (empty cache directory): 51.904s
    • warm run (separate process, same cache directory): 4.953s, 6.548s, 4.073s, 4.264s, 4.651s

Validation

  • npm test -- --testTimeout 30000 (27 test files, 329/329 tests passed)
  • npm run build
  • git status is clean

Notes

  • Behavior remains backwards compatible: stale/incompatible cache entries are refreshed automatically.
  • Warm runs are intentionally measured as separate CLI invocations to match real user usage.

@spMohanty spMohanty force-pushed the dev/cache-parse-parse-performance branch from a7447fb to 5a48154 Compare April 20, 2026 21:56
@spMohanty spMohanty force-pushed the dev/cache-parse-parse-performance branch from 5a48154 to 7594fa0 Compare April 20, 2026 22:08
@iamtoruk iamtoruk self-requested a review April 20, 2026 22:12
@iamtoruk iamtoruk merged commit 7594fa0 into getagentseal:main Apr 20, 2026
@iamtoruk
Copy link
Copy Markdown
Member

Merged, thanks SP! Great contribution.

Added one small fix on top: tightened TypeScript types (type predicates for breakdown validators, null guards on append state), removed unused exports, fixed a file descriptor leak in the offset reader, and cleaned up import ordering.

329 tests passing, cache integrity verified against no-cache output. Appreciate the thorough work on this.

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