Speed up SMB shared-folder transfers#370
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SMB copies were much slower than ISO copies. Three independent causes:
1. Stop-and-wait TCP. v86's userspace TCP sends one 1460-byte segment then blocks on
pending=trueuntil the guest ACKs. Combined with Win95's delayed-ACK, a 64K READ_RAW becomes ~45 emulated round-trips.setupSmbSharenow overridespump()per-connection to keep a window of segments in flight (up to the guest's advertised rwin, capped at 8×MSS so we never overrun the NE2000 RX ring). The link is in-process and lossless — and the original stack has no retransmit anyway — so this is safe.2. Per-byte reply assembly.
buildSmb()andcoreRead()pushed every payload byte into a JSnumber[]then re-copied — ~32KArray.pushcalls per 16K read. Both now allocate oneUint8Arrayandset()the payload.3. Hot-path diagnostics. The
net0-sendframe counter and theconsole.log→appendFileSynctee ran unconditionally on every frame. Both are now gated behindWIN95_SMB_LOG.ISO will always win (ATAPI is
readSync→ guest RAM with no protocol/NIC layer), but the windowing should make SMB severalfold faster.Typecheck clean; all 57 SMB protocol tests pass. The new
buildSmbis byte-identical to the old Writer-based one (verified by diff +parseSmbround-trip).