Skip to content

perf(web): speed up session event virtualization - #565

Merged
Yevanchen merged 2 commits into
mainfrom
perf/web-session-event-virtualization
Aug 21, 2026
Merged

perf(web): speed up session event virtualization#565
Yevanchen merged 2 commits into
mainfrom
perf/web-session-event-virtualization

Conversation

@Yevanchen

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the virtualized session-event drawer's per-scroll linear offset scan with binary search.
  • Add boundary and mixed-row-height equivalence coverage against the previous lookup behavior.

Why

  • The drawer enables virtualization above 200 events, but locating the visible range still scanned every row on each scroll update. Binary search reduces that hot lookup from O(n) to O(log n) without changing row-edge or overscan behavior.

Verification

  • Commands: just check; just test-file apps/web/tests/session-event-drawer-virtualization.test.ts; just test-package @mosoo/web; just tc-package @mosoo/web; just commit-check
  • Manual steps: Compared 5,000 lookups across 10,000 rows; linear lookup took 20.709 ms and binary lookup took 1.671 ms (12.4x faster), with matching checksums.
  • Not run: Browser QA; the change is a pure lookup helper covered across 1,000 mixed-height rows and thousands of scroll positions.

Impact

  • User/API/contract changes: No API or contract changes; large session-event drawers perform less work while scrolling.
  • Generated files / GraphQL / DB / lockfile: None.
  • Env or config changes: None.
  • Risk and rollback: Low. The search relies on the strictly increasing offsets produced by the existing drawer layout; revert this commit to restore the prior linear scan.

Review

  • Closest review areas: Exact row-boundary selection, overscan preservation, and empty-list behavior.
  • Known trade-offs: The implementation intentionally preserves the previous inclusive bottom-edge semantics rather than redefining which row owns an exact boundary.

Closes YEF-1063

@Yevanchen
Yevanchen merged commit 90a2ba0 into main Aug 21, 2026
9 checks passed
@Yevanchen
Yevanchen deleted the perf/web-session-event-virtualization branch August 21, 2026 10:12
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