Commit dc16632
committed
perf: cap the viewport culling margin in graph units
The culling margin was a fraction of the viewport, which is screen-space,
so dividing it by the zoom made it cover more and more of the graph as the
user zoomed out. At minimum zoom it more than doubled the queried area and
mounted far more nodes than a pan could ever reach before the next
recompute - 2012 of 3003 nodes on a large graph.
Cap it at roughly five node widths, which is ample lead time at any zoom.
Working zoom is unaffected: the cap only binds once the ratio exceeds it,
which happens below roughly 0.35 zoom.
Panning a 3000-node graph at minimum zoom:
141.2ms -> 78.7ms median frame, 2012 -> 910 nodes mounted
This does not help when the whole graph is already on screen; no margin
change can cull nodes that are genuinely in view.1 parent 5988bed commit dc16632
2 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
25 | 36 | | |
26 | 37 | | |
27 | 38 | | |
| |||
57 | 68 | | |
58 | 69 | | |
59 | 70 | | |
60 | | - | |
61 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
62 | 79 | | |
63 | 80 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | 87 | | |
| |||
0 commit comments