Commit 9d6df0e
committed
Speedup: Compound read/write fast-path for small SMB files
- Added `Volume::open_read_stream_with_hint(path, size_hint)` to the trait (default falls through to `open_read_stream`). Backends that can exploit a size hint (SMB) override it.
- `SmbVolume` now picks `Tree::read_file_compound` (1 RTT: CREATE+READ+CLOSE in one compound frame) when the caller-provided hint is ≤ negotiated `max_read_size`. Returned bytes are wrapped as a single-chunk `InlineReadStream` so the consumer API is unchanged. Falls back cleanly to the streaming path when the hint is missing, too big, or the compound read returns short.
- `SmbVolume::write_from_stream` drains the source stream when `size ≤ max_write_size` and calls `Tree::write_file_compound` (1 RTT: CREATE+WRITE+FLUSH+CLOSE). Only enabled when size is known up-front — streaming path handles unknown/large sizes.
- `copy_single_path` and `stream_pipe_file` thread a `source_size_hint: Option<u64>` through. The scan HashMap now carries a `SourceHint { is_directory, size }` struct; for top-level files the size is `CopyScanResult.total_bytes`. `copy_directory_streaming` uses `entry.size` from the directory listing.
- On a 60 ms RTT link, a 10 KB SMB→Local copy drops from 3 RTTs + 2 stat probes (Fix 1 removed 1) down to 1 RTT on the read side. The same treatment on the write side collapses 4 RTTs to 1 for small Local→SMB copies.
CLAUDE.md in `volume/` documents the decision; eval numbers live in `docs/notes/phase4-rtt-investigation.md`.1 parent 9409055 commit 9d6df0e
6 files changed
Lines changed: 248 additions & 20 deletions
File tree
- apps/desktop/src-tauri/src/file_system
- volume
- write_operations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
602 | 625 | | |
603 | 626 | | |
604 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
585 | 625 | | |
586 | 626 | | |
587 | 627 | | |
| |||
1074 | 1114 | | |
1075 | 1115 | | |
1076 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1077 | 1165 | | |
1078 | 1166 | | |
1079 | 1167 | | |
| |||
1085 | 1173 | | |
1086 | 1174 | | |
1087 | 1175 | | |
1088 | | - | |
1089 | | - | |
| 1176 | + | |
| 1177 | + | |
1090 | 1178 | | |
1091 | 1179 | | |
1092 | 1180 | | |
| |||
1095 | 1183 | | |
1096 | 1184 | | |
1097 | 1185 | | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1098 | 1231 | | |
1099 | 1232 | | |
1100 | 1233 | | |
| |||
Lines changed: 50 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
| |||
298 | 308 | | |
299 | 309 | | |
300 | 310 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
305 | 316 | | |
306 | 317 | | |
307 | 318 | | |
| |||
312 | 323 | | |
313 | 324 | | |
314 | 325 | | |
315 | | - | |
316 | | - | |
317 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
318 | 330 | | |
319 | 331 | | |
320 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
321 | 339 | | |
322 | 340 | | |
323 | 341 | | |
| |||
354 | 372 | | |
355 | 373 | | |
356 | 374 | | |
357 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
358 | 389 | | |
359 | 390 | | |
360 | 391 | | |
| |||
485 | 516 | | |
486 | 517 | | |
487 | 518 | | |
488 | | - | |
| 519 | + | |
489 | 520 | | |
490 | 521 | | |
491 | 522 | | |
| |||
546 | 577 | | |
547 | 578 | | |
548 | 579 | | |
549 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
550 | 583 | | |
551 | 584 | | |
552 | 585 | | |
| |||
593 | 626 | | |
594 | 627 | | |
595 | 628 | | |
| 629 | + | |
596 | 630 | | |
597 | 631 | | |
598 | 632 | | |
| |||
672 | 706 | | |
673 | 707 | | |
674 | 708 | | |
675 | | - | |
| 709 | + | |
676 | 710 | | |
677 | 711 | | |
678 | 712 | | |
| |||
766 | 800 | | |
767 | 801 | | |
768 | 802 | | |
769 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
770 | 806 | | |
771 | 807 | | |
772 | 808 | | |
773 | 809 | | |
| 810 | + | |
774 | 811 | | |
775 | 812 | | |
776 | 813 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
| |||
0 commit comments