Repository navigation
Make the functions of a TrackedValue on their first use - #21666
Merged
NullVoxPopuli merged 3 commits intoOct 7, 2026
Merged
NullVoxPopuli merged 3 commits into
NullVoxPopuli merged 3 commits into
Conversation
Each TrackedValue made four arrow functions and one options object. `get`, `set`, `update` and `freeze` are now accessors that make the bound function on its first read, and keep it. Each one has a setter, so code can still assign to them. The default options are one frozen object. Split out of emberjs#21650. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 6, 2026
NullVoxPopuli
marked this pull request as ready for review
October 6, 2026 03:29
Removed setter methods for get, set, update, and freeze in TrackedValue.
ef4
previously approved these changes
Oct 6, 2026
ef4
approved these changes
Oct 7, 2026
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.
tracked(value)allocates less. EachTrackedValuemade four arrow functions and one options object. Now it makes a function only when code reads it.This is a part of #21650, and it merges alone. Only
tracked-value.tsand its test change.mainThe gain is in the create of a tracked value. Reads and writes do not change.
What changes
get,set,updateandfreezeare accessors that make the bound function on its first read, and keep it.valueuses an assignedset, as onmain.What changes for callers
Object.keys()and spread do not list them.All 20 cases
mainThe benchmark is https://github.com/NullVoxPopuli-ai-agent/ember-reactivity-bench. One measurement is the writes of one frame, then one flush that brings every output up to date. Each case of each build runs in its own process, pinned to one core. The numbers are the median of 6 mirrored rounds on Node 24.20.
The run has
main, each of the five branches, and #21650 as columns: table and method.Tests
type-check:internals, ESLint and Prettier pass.freeze()prevents updates.The parts of #21650
#21650 has all five changes in one branch. It stays open as the reference for the combined numbers. The five branches merge with no conflict, and their merge is the same code as the head of #21650.
mainTrackedValueon their first use0first in the value field of aTrackedValueRendering was measured for the combined change only:
pnpm benchshows 2.1% less script time, in this comment on #21650.🤖 Generated with Claude Code