Loadout Optimizer: extract helpers to make the process loop readable - #11874
Open
delphiactual wants to merge 1 commit into
Open
Loadout Optimizer: extract helpers to make the process loop readable#11874delphiactual wants to merge 1 commit into
delphiactual wants to merge 1 commit into
Conversation
Review feedback on #11868: the process worker had become hard to follow. Behavior-preserving cleanup of process.ts: - The four outer loop levels shared near-identical inline perk, set bonus, and stat accumulation code; that logic now lives in perkCountsPrune, setBonusPrune, and addItemStats, so each level reads as a uniform sequence of prune checks. - Cold setup code (bucket stat bounds, tuning delta bounds, exact stat range seeding, the Firefox yield workaround) moved out of process() into named top-level functions with their explanatory comments. - The five buildBucketSoA calls collapsed into a map over the buckets, and maxModBonus reuses the precomputed generalModsBonus. No optimizations were removed. The parity suite passes unchanged, and the A/B bench reports the same speedups over the frozen baseline before and after (12.0/2.3/6.8x vs 12.3/2.4/6.8x on the three scenarios).
delphiactual
force-pushed
the
lo-process-readability
branch
from
July 10, 2026 11:29
d2320d1 to
ce9074e
Compare
bhollis
approved these changes
Jul 14, 2026
bhollis
left a comment
Contributor
There was a problem hiding this comment.
Certainly a readability improvement. I'm surprised function calls don't end up more expensive - that's why we'd inlined everything before.
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.
Review feedback on #11868: the process worker had become hard to follow. Behavior-preserving cleanup of process.ts:
No optimizations were removed. The parity suite passes unchanged, and the A/B bench reports the same speedups over the frozen baseline before and after (12.0/2.3/6.8x vs 12.3/2.4/6.8x on the three scenarios).