Commit 4ef4564
committed
Reduce memory footprint
By creating the future manually instead of relying on `async { .. }`, we
workaround rustc's inefficient future layouting. On
[a simple benchmark](https://github.com/hez2010/async-runtimes-benchmarks-2024)
spawning 1M of tasks, this reduces memory use from about 512 bytes per
future to about 340 bytes per future.
More context: hez2010/async-runtimes-benchmarks-2024#11 parent ea9e6e4 commit 4ef4564
2 files changed
+31
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 250 | + | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
| |||
1155 | 1154 | | |
1156 | 1155 | | |
1157 | 1156 | | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
1158 | 1183 | | |
1159 | 1184 | | |
1160 | 1185 | | |
| |||
0 commit comments