From 63288649a8a819d26d766e81ccf885d22d720fcd Mon Sep 17 00:00:00 2001 From: XiangpengHao Date: Wed, 18 Nov 2026 13:47:18 -0500 Subject: [PATCH] Keep every benchmark under bench/ benches/ held one file, the t4 crate's shared_reads micro-benchmark, beside bench/, the benchmark crate. It moves into bench/ as a benchmark of t4-bench; it uses only t4's public API. The flake's comment named a benches/read_throughput.rs that no longer exists. --- Cargo.lock | 4 +++- Cargo.toml | 7 ------- bench/Cargo.toml | 9 +++++++++ {benches => bench/benches}/shared_reads.rs | 0 doc/04-multi-device.md | 2 +- doc/11-shared-mode.md | 4 ++-- flake.nix | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) rename {benches => bench/benches}/shared_reads.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 5a9a36c..4deeb3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4737,7 +4737,6 @@ dependencies = [ "cfg-if", "crc32c", "crossbeam-channel", - "divan", "futures-util", "io-uring", "libc", @@ -4759,6 +4758,7 @@ dependencies = [ "clap", "crc32fast", "datafusion", + "divan", "foyer", "futures-util", "hex", @@ -4770,10 +4770,12 @@ dependencies = [ "libc", "mimalloc", "object_store", + "pollster", "rustls", "rustls-native-certs", "sha2 0.10.9", "t4", + "tempfile", "tokio", "tokio-rustls", "url", diff --git a/Cargo.toml b/Cargo.toml index 101e785..0e71a08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,6 @@ rustix = { version = "1.1.6", features = ["event", "fs", "mm", "net", "process", [dev-dependencies] pollster = "1.0" tempfile = "3" -divan = "0.1.21" [package.metadata.verus] verify = true @@ -65,9 +64,3 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(verus_only)', 'cfg(t4_simu # A module with submodules is a `mod.rs` in its own directory, never a # `foo.rs` beside a `foo/`: one place to look for a module. self_named_module_files = "deny" - -# A hot read's time through an unshared cache, and a shared cache's owner -# and its client (`doc/11-shared-mode.md`, Cost). -[[bench]] -name = "shared_reads" -harness = false diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 718603f..30aba2a 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -56,4 +56,13 @@ default = ["mimalloc"] mimalloc = ["dep:mimalloc"] [dev-dependencies] +divan = "0.1.21" +pollster = "1.0" +tempfile = "3" tokio = { version = "1", features = ["test-util"] } + +# A hot read's time through an unshared cache, and a shared cache's owner +# and its client (`doc/11-shared-mode.md`, Cost). +[[bench]] +name = "shared_reads" +harness = false diff --git a/benches/shared_reads.rs b/bench/benches/shared_reads.rs similarity index 100% rename from benches/shared_reads.rs rename to bench/benches/shared_reads.rs diff --git a/doc/04-multi-device.md b/doc/04-multi-device.md index 76a30db..0ecf157 100644 --- a/doc/04-multi-device.md +++ b/doc/04-multi-device.md @@ -173,7 +173,7 @@ first made as the output was: a system call a read, whatever tier served it. A read from memory copies its bytes on its own task and so faults in its own pages; the call bought it nothing. Now the pages lent to a disk read are populated as they are lent (`ReadOutput::lend_to_disk_read`), and -no others. One hot read from memory at a time (`benches/shared_reads.rs`, +no others. One hot read from memory at a time (`bench/benches/shared_reads.rs`, the median of 100 reads) on an i7i.24xlarge (Xeon 8559C, Linux 7.0, glibc 2.42): diff --git a/doc/11-shared-mode.md b/doc/11-shared-mode.md index 9187c77..a0a57c2 100644 --- a/doc/11-shared-mode.md +++ b/doc/11-shared-mode.md @@ -415,7 +415,7 @@ owner. A read is one call however many blocks it spans, and calls are pipelined. The owner's own reads cost what they cost now. **Measured** on a MacBook (Apple silicon, a desktop's load, 30 Oct 2026; -`benches/shared_reads.rs`, both caches in one process, the file gone from +`bench/benches/shared_reads.rs`, both caches in one process, the file gone from the store so that only the cache can serve it), median of 100: | a hot read of | the owner's own | its client's | @@ -638,7 +638,7 @@ spins. `T4Caching::read_through`, `fetch` and `turn` serve both with one copy of their logic. The boxes cost no measured time: an owner's hot 4 KiB read took 429 ns, against 421 ns through the enum, - within a run's spread (`benches/shared_reads.rs`, 2 Nov 2026). + within a run's spread (`bench/benches/shared_reads.rs`, 2 Nov 2026). 3. **The socket, bytes in its frames,** on Linux and macOS: the owner listens, a client connects on `Busy`, the handshake, failures to the remote, a client coming to own the cache. Tests in one process (a diff --git a/flake.nix b/flake.nix index 996e1ec..01b368c 100644 --- a/flake.nix +++ b/flake.nix @@ -259,7 +259,7 @@ pkgs.cargo-binutils verus verusfmt - # benches/read_throughput.rs's baseline, and its plot. + # fio, for the drives' baseline (doc/04); Python for plots. pkgs.fio (pkgs.python3.withPackages (ps: [ ps.matplotlib ])) ];