Conversation
Collapsed `EvalContext`'s `expression`/`rendered` fragment arrays into single strings, then moved both onto `EvalResult` so no branch can omit one. Dropped `ctx` from `evalLiteral` and `evalVariable`, which no longer need it. Rebuilt `rewriteFlags` as one loop rather than a closure, a filter array and a spread, keeping the fresh-array guarantee `mergeMetaRolls` depends on. Suppressed the discarded pool render in a modifier's target context, routing every pool render through `renderedPool`. Replaced `keptIndices.includes` with a `Set` in `renderGroup`. Added `100d10ro<3` and `100d10kh50sd cs>8` benchmark cases. Recorded why `toSeedString` stays on decimal. Co-Authored-By: Mikita Taukachou <edloidas@gmail.com>
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.
Collapsed
EvalContext'sexpression/renderedfragment arrays into single strings, then moved both ontoEvalResult. Everyeval*runs against a context of its own and pushed each array exactly once, so the arrays never held more than one element and every parent joined a one-element array. Returning them instead makes a forgotten write a type error rather than an empty string in a user-visibleRollResult.expression— it caught a missingevalFunctionCallfield on the first compile.EvalContextnow holds only what flows up unchanged or merged (rolls,versusMetadata) plus the parent-setsuppressRender; everything a wrapper reformats ridesEvalResult.Rebuilt
rewriteFlagsas one loop instead of a closure, a filter array and a spread. It still always returns a fresh array — a variant returning the input when it already equalled the result was rejected becausemergeMetaRollsclones a die as{ ...die, modifiers: rewriteFlags(...) }and would alias flags that later passes mutate.Suppressed the discarded pool render in a modifier's target context. Each pool modifier rebuilds the breakdown from its target's
expressionplus arenderDicepass of its own, so the target's own render was thrown away; in a chain each modifier's context is the next one out's discarded target, so every level above the innermost was also rendering into the void.Also swapped
keptIndices.includesfor aSetinrenderGroup, added100d10ro<3and100d10kh50sd cs>8benchmark cases for the two shapes with no coverage, and recorded whytoSeedStringstays on decimal.Measured, medians of 5, A/B against
master:1d202d6+34d6kh3floor((1d4+1)*2/3)2d20kh1 vs 1510d10sd>=6f1100d10kh50sd cs>8No behavior change:
rendered,expressionand theRollResultshape are byte-identical, and therenderBreakdownparity property test still holds. Sizes fell rather than rose, so no budget change:index.js13.16 -> 13.09 kB,{ roll }12.91 -> 12.85 kB.Closes #336