Skip to content

Optimize indexed read-only collection writes - #12

Merged
skuirrels merged 1 commit into
mainfrom
feature/indexed-readonly-list-writes
Aug 4, 2026
Merged

Optimize indexed read-only collection writes#12
skuirrels merged 1 commit into
mainfrom
feature/indexed-readonly-list-writes

Conversation

@skuirrels

Copy link
Copy Markdown
Owner

What changed

  • add cached index-based writers for IList<T> and IReadOnlyList<T> collection values
  • preserve the exact array and List<T> writer paths
  • preserve the enumerable fallback for ambiguous generic element types
  • add coverage for ReadOnlyCollection<T>, derived lists, custom read-only lists, vector boundaries, and ambiguous collections

Why

ReadOnlyCollection<T> values previously used the typed enumerable fallback. Repeated interface enumeration boxed an enumerator for every appended collection, causing avoidable managed allocations in high-volume LIST writes.

Benchmark evidence

Controlled BenchmarkDotNet run with 1,000,000 rows and 32 integers per collection:

  • ReadOnlyCollection<T> to LIST: 157.3 ms to 150.9 ms, approximately 4.1% faster
  • managed allocation: 31,343.4 KB to 91.8 KB, approximately 99.7% lower
  • Gen0 collections: 3,000 to zero
  • array, exact List<T>, and fixed-array control cases had overlapping confidence intervals and no meaningful winner

Validation

  • .NET 8 full suite: 7,030 passed
  • .NET 10 full suite: 7,029 passed
  • Release solution build succeeded
  • git diff --check passed
  • final code review found no remaining actionable findings

Release

Intended for stable fork release v1.5.5.4 after hosted checks pass.

@skuirrels
skuirrels merged commit ed4ed58 into main Aug 4, 2026
6 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant