perf(web): speed up large dataset dashboards - #99
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Dashboard latency grew with the product database rather than the requested window. The main indexes placed
bucket_startbefore source and visibility filters, so SQLite scanned unrelated scopes. The page also fetched and rendered every chart on mount, repeated metadata and coverage queries, recreated Chart.js instances, and rebuilt timezone formatters in hot loops. Those costs were especially visible over an SSH tunnel.Solution
source_members, shared coverage reads, parallel characteristics queries, conditional port aggregation, and smaller IP/protocol response objects.Measured on the generated 880 MB fixture with 16 sources and 80 ms simulated latency:
The query-aligned traffic index reduced a 2.88 million-row synthetic query from 239.5 ms to 82.4 ms.
Review fast path
Build the large fixture and start the preview:
Run the profilers from another shell:
Flows to exercise:
Important decisions and edge cases:
0002runsPRAGMA optimizeafter creating indexes so the planner can select them immediately.Verification
bun run formatbun run lintbun run typecheckbun run test: 133 web tests and 133 Rust library tests, plus all Rust integration suitesbun run build:webbun run --cwd apps/web db:generate: no schema changesRemaining manual verification: none.
Built with GPT-5.6 Sol in T3 Code, with parallel Codex subagents for profiling, implementation, and adversarial review.