test(core): pin batch-after-per-tag ordering; relocate batch tests beside the engine suite

This commit is contained in:
Joseph Doherty
2026-08-15 12:21:42 -04:00
parent cd4ce305a2
commit f81cbabd2d
3 changed files with 132 additions and 5 deletions
@@ -242,7 +242,10 @@ public sealed class PollGroupEngine : IAsyncDisposable
{
state.LastValues[tagRef] = current;
_onChange(state.Handle, tagRef, current);
if (_onBatch is not null) (changed ??= new List<DataChangeItem>()).Add(new DataChangeItem(tagRef, current));
// Capacity hint: a cycle can produce at most one item per subscribed reference, so
// sizing the list once avoids the doubling re-allocations a large group would incur.
if (_onBatch is not null)
(changed ??= new List<DataChangeItem>(state.TagReferences.Count)).Add(new DataChangeItem(tagRef, current));
}
}