Commit a4699d9
Performance improvements for gem dropdown sort (#2184)
* Speed up gem dropdown DPS sorting and hover tooltips
The dropdown hover tooltip was cleared and rebuilt every frame, and each
rebuild runs a full build calculation - hovering one gem cost ~60 full
calcs per second. It now rebuilds only when the hovered gem, the build's
outputRevision, or the relevant default settings change
(tooltip:CheckForUpdate), turning the per-frame cost into a one-time cost
per hovered gem.
This also implements the fastCalcOptions path that the DPS sort loop was
already calling into: UpdateSortCache defines the options and
CalcOutputWithThisGem forwards them to the misc calculator, which now
accepts them as an optional third argument:
- Accelerated environment reuse: per-gem calcs carry over the cached
player/enemy/minion DBs and a persistent environment with the existing
accelerate flags (nodeAlloc, requirementsItems, requirementsGems),
instead of rebuilding unchanged state from scratch for every gem.
- skipEHP: defence estimations (EHP/max hit) are skipped during sorting
unless sorting by Effective Hit Pool.
- fullDPSOnly: when sorting by Full DPS, only the calcFullDPS roll-up is
computed; the main-skill pass whose output was discarded is skipped.
All other GetMiscCalculator callers pass two arguments and are unchanged.
Verified by comparing outputs of the fast and unaccelerated paths for
every supportable gem on test builds: identical results across all sort
fields.
* Cache per-skill Full DPS results during gem dropdown sorting
When sorting the gem dropdown by Full DPS, every candidate gem triggered
a full calcFullDPS pass: one perform per Full-DPS-included skill, even
though a support socketed into one group cannot affect most other
skills. On builds with many included skills (e.g. several companions),
this multiplied the cost of every dropdown open by the skill count.
calcFullDPS now supports an optional per-skill result cache
(specEnv.fullDPSCache), driven by diffing each skill's calculation
inputs rather than by guessing what the candidate gem does:
- During the base pass, each skill's harvested outputs are captured into
a plain snapshot, together with its input references: the skill's own
modifier list and the environment's "coupling surface" - the buffs,
auras and curses every skill provides (buffList) and the exposure it
can inflict, which are the channels through which one skill's gems can
influence another skill's results.
- On later calls, a skill whose own modifier list and the coupling
surface are both unchanged merges its cached snapshot instead of
recalculating. Anything that touches the surface (auras, exposure,
buff-granting supports) conservatively recalculates every skill.
- Modifier lists are compared by table identity, with a depth-limited
structural fallback for the few modifiers that are reconstructed on
every initEnv, which would otherwise defeat the diff.
The harvest section of calcFullDPS is restructured into capture-then-
merge to make snapshots replayable; merge order and semantics (sum vs
maximum fields, Absolution count fix, entry naming) are preserved
exactly. The cache is only used by the gem sort's fullDPSOnly path and
is rebuilt with the calculator on every build change, so all other
calcFullDPS callers and any stale-data concerns are unaffected.
Adds TestFullDPSCache covering: cached results matching fresh
calculations, local supports reusing other skills' results, exposure and
aura supports forcing recalculation, the reconstructed-modifier corner
case, candidate gem levels, and cache invalidation on build changes.
* Simplify Full DPS harvesting into shared folding and uniform actor entries
- Replace the repeated per-stat, per-actor merge blocks with a single
merge spec and fold; pass snapshots hold uniform per-actor entries,
with the per-actor differences (entry naming, pass counts, dot scaling
and gating) resolved as plain data at capture time.
- Unify the captured output fields into one harvestFields list. Stats
previously not folded for minions never occur on test builds, and the
mirage path is currently disabled, so results are unchanged.
- Compare modifiers with tableDeepEquals, called in both directions
since it only inspects the first table's keys; a one-sided match could
let a modifier that gained a field produce a stale cache hit.
* Fix cache for triggered skills
* Indent
* Fix merge issues
---------
Co-authored-by: LocalIdentity <localidentity2@gmail.com>1 parent 0d6108b commit a4699d9
3 files changed
Lines changed: 437 additions & 147 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
320 | | - | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| |||
462 | 466 | | |
463 | 467 | | |
464 | 468 | | |
465 | | - | |
466 | 469 | | |
467 | 470 | | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
487 | 495 | | |
488 | 496 | | |
489 | 497 | | |
| |||
508 | 516 | | |
509 | 517 | | |
510 | 518 | | |
511 | | - | |
| 519 | + | |
| 520 | + | |
512 | 521 | | |
513 | 522 | | |
514 | 523 | | |
| |||
0 commit comments