Commit 4fe2f1a
Perf: optimise mapiAsync with direct enumerator
Replace the asyncSeq-builder + collect implementation of mapiAsync with
a new OptimizedMapiAsyncEnumerator that iterates the source directly and
maintains the index in a mutable field. This mirrors the existing
OptimizedMapAsyncEnumerator and eliminates the collect/For overhead that
was previously incurred for every element.
Also adds AsyncSeqMapiBenchmarks to measure mapAsync vs mapiAsync vs mapi.
Co-authored-by: Copilot <[email protected]>1 parent bc5c1f0 commit 4fe2f1a
3 files changed
Lines changed: 62 additions & 6 deletions
File tree
- src/FSharp.Control.AsyncSeq
- tests/FSharp.Control.AsyncSeq.Benchmarks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
924 | 924 | | |
925 | 925 | | |
926 | 926 | | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
927 | 950 | | |
928 | 951 | | |
929 | 952 | | |
| |||
980 | 1003 | | |
981 | 1004 | | |
982 | 1005 | | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
| 1006 | + | |
| 1007 | + | |
989 | 1008 | | |
990 | 1009 | | |
991 | 1010 | | |
| |||
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
182 | 215 | | |
183 | 216 | | |
184 | 217 | | |
| |||
0 commit comments