Commit 61f0241
perf: reuse ResizeArray buffer in chunkBy and chunkByAsync
Previously, each time a new chunk was started in chunkBy/chunkByAsync,
a fresh ResizeArray was allocated. Since ToArray() already captures an
independent copy of the data, the internal buffer can be safely reused
by calling Clear() instead of constructing a new ResizeArray.
This eliminates one heap allocation per chunk boundary, reducing GC
pressure for sequences with many distinct runs.
5017 tests pass, 2 skipped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 852f4b1 commit 61f0241
File tree
2 files changed
+3
-2
lines changed- src/FSharp.Control.TaskSeq
2 files changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1754 | 1754 | | |
1755 | 1755 | | |
1756 | 1756 | | |
1757 | | - | |
| 1757 | + | |
1758 | 1758 | | |
1759 | 1759 | | |
1760 | 1760 | | |
| |||
1782 | 1782 | | |
1783 | 1783 | | |
1784 | 1784 | | |
1785 | | - | |
| 1785 | + | |
1786 | 1786 | | |
1787 | 1787 | | |
1788 | 1788 | | |
| |||
0 commit comments