bench(fast_io): IOCP vs stdio write throughput on Windows (#1899)#4241
Merged
Conversation
Adds a Criterion bench that compares the Windows IOCP writer path (IocpDiskBatch) against std::fs and BufWriter baselines across 4 KiB, 64 KiB, and 1 MiB payloads. Closes the "wired but never measured" gap from #1868 with repeatable data on whether the IOCP path actually helps under typical and high-concurrency loads. Four cells per payload size: - iocp_default: IocpDiskBatch with default concurrent_ops (4) - iocp_concurrent_ops_8: IocpDiskBatch with concurrent_ops = 8 - stdfs: std::fs::File::create + write_all baseline - bufwriter_64k: BufWriter<File> with a 64 KiB buffer The bench is cfg-gated to target_os = "windows" + iocp feature; on Linux and macOS the file compiles to a stub main that prints a skip line, so cargo bench -p fast_io is cheap on every other host.
a864384 to
eaa321c
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
) Adds a Criterion bench that compares the Windows IOCP writer path (IocpDiskBatch) against std::fs and BufWriter baselines across 4 KiB, 64 KiB, and 1 MiB payloads. Closes the "wired but never measured" gap from #1868 with repeatable data on whether the IOCP path actually helps under typical and high-concurrency loads. Four cells per payload size: - iocp_default: IocpDiskBatch with default concurrent_ops (4) - iocp_concurrent_ops_8: IocpDiskBatch with concurrent_ops = 8 - stdfs: std::fs::File::create + write_all baseline - bufwriter_64k: BufWriter<File> with a 64 KiB buffer The bench is cfg-gated to target_os = "windows" + iocp feature; on Linux and macOS the file compiles to a stub main that prints a skip line, so cargo bench -p fast_io is cheap on every other host.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
) Adds a Criterion bench that compares the Windows IOCP writer path (IocpDiskBatch) against std::fs and BufWriter baselines across 4 KiB, 64 KiB, and 1 MiB payloads. Closes the "wired but never measured" gap from #1868 with repeatable data on whether the IOCP path actually helps under typical and high-concurrency loads. Four cells per payload size: - iocp_default: IocpDiskBatch with default concurrent_ops (4) - iocp_concurrent_ops_8: IocpDiskBatch with concurrent_ops = 8 - stdfs: std::fs::File::create + write_all baseline - bufwriter_64k: BufWriter<File> with a 64 KiB buffer The bench is cfg-gated to target_os = "windows" + iocp feature; on Linux and macOS the file compiles to a stub main that prints a skip line, so cargo bench -p fast_io is cheap on every other host.
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.
Summary
crates/fast_io/benches/iocp_vs_stdio.rs, a Criterion bench that pits the Windows IOCP writer path (IocpDiskBatch) againststd::fsandBufWriter<File>baselines.iocp_default,iocp_concurrent_ops_8,stdfs,bufwriter_64k. Each cell writes 1000 files into a freshtempfile::TempDirper iteration.Implementation notes
target_os = "windows"+ theiocpfeature. On Linux and macOS the file compiles to a stubfn main()that prints a skip line, socargo bench -p fast_iostays cheap on every other host.IocpDiskBatchis the only writer surface that consumesIocpConfig::concurrent_ops(viasubmit_write_batchincrates/fast_io/src/iocp/disk_batch.rs). The bench drives it through the samebegin_file->write_data->commit_filesequence the receiver disk-commit thread uses.bufwriter_64kmatches the defaultIocpConfig::buffer_sizeso the comparison isolates overlapped submission from buffering.Test plan
cargo bench -p fast_io --bench iocp_vs_stdioon a Windows host produces three throughput rows periocp_default/iocp_concurrent_ops_8/stdfs/bufwriter_64kcell.cargo build -p fast_io --bench iocp_vs_stdioon Linux and macOS hosts compiles to a no-op stub that runs and prints the skip line.