Commit e4d45c6
Improve PercentileLineChart perf (and thus Summary page) by over 20x (#469)
## Summary
By extracting `series` from the markup (which made it reactive) and
intentionally NOT using `$derived`, rendering performance of
`PercentileLineChart` improved by over 20x (`>1100ms` down to `<50ms`).
This makes navigating to the Summary tab MUCH better (before we would
sometimes hit the browser "Are you sure you want to wait" prompts).
`$state.opaque()` runes was being
[considered](sveltejs/svelte#14639) that could
have helped here, but it was decided to not be the right abstraction.
(I'm waiting on a solution to fix LayerChart's force simulations that
have a perf regression in Svelte 5 due to granular reactivity / proxy
creation)
## Before
https://github.com/user-attachments/assets/9e93f4eb-5247-4bff-a56d-413564e50022
## After
https://github.com/user-attachments/assets/8dbe075d-0479-4d5e-a3f8-45fb1d350402
## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Optimized the chart component's data handling to improve performance
and overall clarity.
- Adjusted the internal structure by moving data definitions outside
inline usage and refining type specifications for better consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- av pr metadata
This information is embedded by the av CLI when creating PRs to track
the status of stacks when using Aviator. Please do not delete or edit
this section of the PR.
```
{"parent":"main","parentHead":"","trunk":"main"}
```
-->
---------
Co-authored-by: Sean Lynch <[email protected]>1 parent 13ee2d1 commit e4d45c6
File tree
1 file changed
+12
-10
lines changed- frontend/src/lib/components/charts
1 file changed
+12
-10
lines changedLines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | 20 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 21 | + | |
| 22 | + | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
| |||
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | | - | |
| 32 | + | |
37 | 33 | | |
38 | 34 | | |
39 | | - | |
| 35 | + | |
40 | 36 | | |
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
0 commit comments