Commit 77ea6e8
committed
Speedup: Pipeline SMB scan-phase stats (Phase 4 Fix 4)
- Override `Volume::scan_for_copy_batch` on `SmbVolume` to fan out all per-path stats over one SMB session instead of N sequential RTTs. Each path gets a cloned `smb2::Connection` under a brief client-mutex acquire (cheap `Arc::clone` — all clones multiplex over the same TCP session), then drives `tree.stat` inside a `FuturesUnordered`.
- Trait change: `scan_for_copy_batch` now returns `BatchScanResult { aggregate, per_path }`. The copy engine's `source_hints` map is populated from `per_path`, saving the old per-source re-stat. `MtpVolume` override updated; default impl preserves the serial per-path loop for local backends.
- Single-path batches fall through to `scan_recursive` (regression guard for drag-drop-one-file). Empty root paths skip the stat and route into the directory-recursion list directly.
- Wire trace measured at N=10 on the Tailscale link: all 10 stat compounds dispatched back-to-back before any response arrives, then 10 compound reads dispatched the same way.
- Bench result (100 × 10 KB, QNAP → local, ~60 ms RTT): 6.11 s → 947 ms, a 6.5× wall-clock win. Per-file: 61 ms → 9.5 ms. Effective concurrency 156 / 9.5 ≈ 16×.
- Docs: Updated `volume/CLAUDE.md` + `write_operations/CLAUDE.md` with the `scan_for_copy_batch` signature change and the SMB override's rationale. Appended a "Phase 4 Fix 4 results (2026-04-21)" section to `docs/notes/phase4-rtt-investigation.md` with the bench numbers, wire trace, and effective-concurrency analysis.
- Tooling: Marked `env_logger` as a `#[cfg(test)] use ... as _;` shim in `lib.rs` so the dev-dep doesn't trigger `unused_crate_dependencies` when the bench's optional `try_init` is inactive.1 parent f7823a0 commit 77ea6e8
10 files changed
Lines changed: 511 additions & 58 deletions
File tree
- apps/desktop/src-tauri/src
- file_system
- volume
- write_operations
- docs/notes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
366 | 372 | | |
367 | 373 | | |
368 | 374 | | |
| |||
Lines changed: 33 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
521 | | - | |
522 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
| |||
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
541 | | - | |
542 | | - | |
543 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
544 | 560 | | |
545 | 561 | | |
546 | 562 | | |
547 | 563 | | |
548 | 564 | | |
549 | 565 | | |
550 | | - | |
551 | | - | |
552 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
553 | 570 | | |
554 | 571 | | |
555 | 572 | | |
| |||
563 | 580 | | |
564 | 581 | | |
565 | 582 | | |
566 | | - | |
567 | | - | |
568 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
569 | 587 | | |
570 | 588 | | |
571 | 589 | | |
| |||
578 | 596 | | |
579 | 597 | | |
580 | 598 | | |
581 | | - | |
582 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
583 | 602 | | |
584 | 603 | | |
585 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
| |||
497 | 515 | | |
498 | 516 | | |
499 | 517 | | |
500 | | - | |
| 518 | + | |
501 | 519 | | |
502 | 520 | | |
503 | 521 | | |
504 | 522 | | |
505 | | - | |
506 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
507 | 531 | | |
508 | 532 | | |
509 | 533 | | |
510 | | - | |
| 534 | + | |
511 | 535 | | |
512 | | - | |
| 536 | + | |
513 | 537 | | |
514 | 538 | | |
515 | 539 | | |
516 | 540 | | |
517 | | - | |
| 541 | + | |
518 | 542 | | |
519 | 543 | | |
| 544 | + | |
520 | 545 | | |
521 | 546 | | |
522 | | - | |
523 | | - | |
524 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
525 | 551 | | |
526 | | - | |
| 552 | + | |
527 | 553 | | |
528 | 554 | | |
529 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
| 465 | + | |
465 | 466 | | |
466 | 467 | | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
472 | 476 | | |
473 | 477 | | |
474 | 478 | | |
| |||
487 | 491 | | |
488 | 492 | | |
489 | 493 | | |
490 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
491 | 500 | | |
492 | 501 | | |
493 | 502 | | |
| |||
507 | 516 | | |
508 | 517 | | |
509 | 518 | | |
510 | | - | |
511 | | - | |
512 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
513 | 523 | | |
514 | | - | |
515 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
516 | 536 | | |
517 | 537 | | |
518 | 538 | | |
519 | 539 | | |
520 | 540 | | |
521 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
522 | 547 | | |
523 | 548 | | |
524 | 549 | | |
| |||
0 commit comments