Repository navigation
docs: clarify post-initializer chaining precedence in spec 019 - #60
Merged
Chris Anderson (codemonkeychris) merged 1 commit intoApr 21, 2026
Conversation
Update the Factory Initializers (Option F) comparison to reflect that trailing initializers bind at primary-expression precedence, so post-initializer method chaining works without parentheses. This is a deliberate divergence from `with` and is covered by the prototype's Chained_* regression tests. Also expand the 'Compared to Current' section to explain how this benefits attached-property extension methods (.Flex, .Grid, .Dock) composing naturally with factory initializers. Co-authored-by: Copilot <[email protected]>
Chris Anderson (codemonkeychris)
deleted the
docs/019-factory-initializer-precedence-clarification
branch
May 28, 2026 19:11
This was referenced Jun 25, 2026
Alexandre Zollinger Chohfi (azchohfi)
added a commit
that referenced
this pull request
Jun 26, 2026
Round 11 Copilot review on 5084bf4: the #60 pooled name->control map was created without an initial capacity, so the first reconcile (and any growth beyond the high-water capacity) resizes internally while populating pairs.Count entries. The non-pool reentrant path already seeds new Dictionary(pairs.Count, ...); the pooled path did not. Fix: seed the pooled dictionary with pairs.Count on first creation, mirroring the non-pool path. Dictionary.Clear() retains capacity, so this is a one-time first- reconcile improvement -- later passes already reuse the high-water capacity. No observable behavior change (same entries, same lookups); no new test added because steady-state was already resize-free and the change is a creation-time capacity hint. Existing RelativePanel/PanelAttached tests + full suite stay green. Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
added a commit
that referenced
this pull request
Jun 26, 2026
Every component re-render re-runs every hook, so per-render hook allocations multiply by cells x hooks on data-grid workloads (StocksGrid). This eliminates the hot-path allocations in the hooks bookkeeping layer while preserving the rules of hooks (same call order/count/types every render) and observable semantics. RenderContext.cs: - #42 ValueHookState Lock is now lazy/nullable (allocated only when threadSafe:true); saves N rows x M hooks of unused Lock objects. - #43 UseState setter cached on the hook slot (built once, not a new display-class + Action<T> every render). - #44 UseReducer<T> updater and UseReducer<TState,TAction> dispatch delegates cached on the hook; dispatch reads the latest reducer from state (matches React semantics). - #45/#46/#48 UseEffect/UseMemo/UseCallback gain arity 1-3 deps overloads that compare deps without boxing and allocate the deps array only when deps actually change; params overloads kept as fallback and now assign Dependencies directly (no extra ToArray). UseCallback no longer allocates a ()=>callback wrapper. - #50 _hooks list pre-sized to new(8) to avoid mount realloc churn. - #51 ContextHooks uses a struct enumerator (no heap enumerator per render); still implements IEnumerable for existing .ToList() callers. - #52 UseCommand/UseCommand<T> use an inline memo slot instead of a per-render factory closure capturing 7 vars. - #53 UsePersisted setter cached on the hook slot. - #56 new internal UseDisposableEffect(IDisposable) mount-once helper with a stable teardown (no 2 lambdas per render). Hooks/: - #47 UseMemoCells/ByKey/ByIndex early full-reuse: return the prior children array and skip snapshot/dict allocation on a full cache hit. - #59 UseMemoCellsByKey computes each key once per item into a buffer instead of invoking the key selector twice. - #55 UseElementFocus caches the requestFocus closure and DispatcherQueue in refs instead of allocating + a COM call every render. - #57 UseResource uses an Interlocked counter id (not Guid.NewGuid) and skips the deps-hash rebuild when deps are unchanged; #56 disposes via UseDisposableEffect. - #56 UseMutation/UseInfiniteResource dispose via UseDisposableEffect. PanelAttachedHooks.cs: - #60 ApplyRelativePanelAttachedProps reuses a thread-static name-map dictionary (with a reentrancy guard for nested RelativePanels) instead of allocating one per reconcile. Tests: tests/Reactor.Tests/HookAllocationPerfTests.cs (25 tests) cover cached-delegate identity across renders, deps short-circuit (params + arity), threadSafe Lock still allocated + correct under concurrent writes (null when not requested), and UseMemoCells/ByKey/ByIndex cache-hit returning the same prior children array. The two committed skills/reactor.api.txt copies are regenerated to add the new public arity overloads (UseDisposableEffect stays internal). Closes #659 Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
added a commit
that referenced
this pull request
Jun 26, 2026
Round 11 Copilot review on 5084bf4: the #60 pooled name->control map was created without an initial capacity, so the first reconcile (and any growth beyond the high-water capacity) resizes internally while populating pairs.Count entries. The non-pool reentrant path already seeds new Dictionary(pairs.Count, ...); the pooled path did not. Fix: seed the pooled dictionary with pairs.Count on first creation, mirroring the non-pool path. Dictionary.Clear() retains capacity, so this is a one-time first- reconcile improvement -- later passes already reuse the high-water capacity. No observable behavior change (same entries, same lookups); no new test added because steady-state was already resize-free and the change is a creation-time capacity hint. Existing RelativePanel/PanelAttached tests + full suite stay green. Co-authored-by: Copilot <[email protected]>
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.
Update the Factory Initializers (Option F) comparison in spec 019 to reflect that trailing initializers bind at primary-expression precedence, so post-initializer method chaining (e.g. \\Factory() { X = V }.M()\) works without parentheses.
Changes