perf(consume): optimize multi-effect active effect application #126
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Athemis/ds4#126
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Optimize
applyConsumeActiveEffects()for consumables with multiple active effects. The current implementation insrc/apps/actor/consume-flow.jsscans the target actor's effects, then processes every consume effect sequentially and awaits each duration roll inside the loop. That is acceptable for a single effect, but scales poorly for multi-effect consumables because replace lookups,toObject()cloning, flag merging, and duration evaluation all happen per entry in a strictly serialized path.A follow-up should reduce the amount of sequential work in this path and keep the runtime cost closer to the actual number of changes that need to be persisted.
Context
Evidence:
src/apps/actor/consume-flow.js:94buildsexistingKeysby scanning all target actor effects for every consume action.src/apps/actor/consume-flow.js:107iterates each consume effect entry.src/apps/actor/consume-flow.js:127tosrc/apps/actor/consume-flow.js:157resolves and evaluates duration formulas withawait durationRoll.evaluate()inside the loop.This is the clearest remaining consume-flow hotspot after fixing eager description enrichment in #123.