Skip to content

Speed up reload and resume#238

Merged
dnouri merged 5 commits into
masterfrom
fix/reload-resume-performance
Jun 24, 2026
Merged

Speed up reload and resume#238
dnouri merged 5 commits into
masterfrom
fix/reload-resume-performance

Conversation

@dnouri

@dnouri dnouri commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Reloading and resuming long sessions should feel much snappier now.

This PR fixes the two slow paths that dominated profiling:

  • large get_messages RPC responses are accumulated linearly instead of repeatedly copying the growing partial JSON line
  • the resume picker no longer parses every session file twice, and metadata extraction avoids parsing full message payloads when it only needs counts/name/first message

It keeps one small render-path improvement: full history replay temporarily raises the GC threshold so GC does not interrupt the visible rebuild. The render benchmark is roughly flat; the big wins come from RPC framing and session metadata scanning.

It also adds a deterministic synthetic reload/resume benchmark suite with GUI/xvfb as the primary lane and batch as the CI-friendly smoke lane.

Benchmark results

Synthetic fixtures, GUI via xvfb, 3 repetitions per scenario, diagnostic timing advice disabled:

scenario operation before after speedup
large RPC response resume 13.509s 1.439s 9.4x
large RPC response reload 12.828s 1.313s 9.8x
metadata-heavy resume directory resume 5.845s 0.535s 10.9x
metadata-heavy resume directory reload 0.317s 0.265s 1.2x
mixed render workload resume 3.997s 3.968s 1.0x
mixed render workload reload 4.051s 3.797s 1.1x

The committed benchmark can be run with:

make bench-reload-resume          # GUI/xvfb, primary lane
make bench-reload-resume-batch    # batch, secondary lane
make bench-reload-resume-smoke    # cheap CI-friendly smoke

Validation

  • make check
  • reload/resume benchmark smoke in batch and GUI/xvfb
  • reload/resume before/after benchmark run with synthetic fixtures

@dnouri dnouri merged commit 308c74b into master Jun 24, 2026
11 checks passed
@dnouri dnouri deleted the fix/reload-resume-performance branch June 24, 2026 19:31
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