Skip to content

perf: renderDashboard runs the full parse pipeline 3x per command — collapse to one pass #1106

Closed

Description

@iamtoruk

Successor to #1104 (PR #1105). Post-fan-out profile on the 21k-file corpus shows the discovery sweep is down to ~570ms/pass, but warm dated commands still cost ~3s because renderDashboard (src/dashboard.tsx:1881/1883/1887) issues three parseAllSessions calls with three different ranges and none share a memo — the exact-key memo needs identical ranges and burstReuse is gated off for one-shot CLI.

Per-pass floor that multiplies by 3 (measured):

  • correlateCrossProviderPrSessions ~270ms — has two .filter() calls inside loops (src/parser.ts:4511, :4551)
  • loadCache ~190ms
  • claude parse/summarize ~220ms, other providers ~200ms

Directions (each needs parity analysis):

  • Collapse the three range-distinct calls into one superset parse + range-slice in memory
  • Or generalize burstReuse from start-equality to range-containment — parity-risky: monthScopeForRange changes which shards load and therefore which cross-file dedups fire
  • Independent quick win: hoist the loop-invariant filters in correlateCrossProviderPrSessions

Also noticed while testing: vitest.config.ts has no exclude, so stale .claude/worktrees/*/tests/ get swept into npm test on dev machines — worth exclude: ['**/.claude/worktrees/**'].

Prize: this is the remaining lever between 3s and the sub-second warm target.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions