summaryrefslogtreecommitdiff
path: root/test/rollback_bench.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/rollback_bench.zig')
-rw-r--r--test/rollback_bench.zig29
1 files changed, 11 insertions, 18 deletions
diff --git a/test/rollback_bench.zig b/test/rollback_bench.zig
index 3f8213d2..1260f47e 100644
--- a/test/rollback_bench.zig
+++ b/test/rollback_bench.zig
@@ -3,19 +3,18 @@
//! (open point 5). A typical session and a big one are built in process, on
//! a rollback epoch's allocator as a replica's core is; for each:
//! - the copy taken and let go: its time, the bytes it saves, the bytes
-//! it pins (a file's text, its undo snapshots);
+//! it pins (the journal's entries, a register's texts);
//! - a key that edits a file (`x`) applied on top, as a speculation, and
//! the copy put back: the apply's time and the restore's.
//! Then a fork of the big one, child gone at once, and the authority's
//! copy-on-write after it. Last, a session's authority with a 100 MB file
//! open (src/replica.zig): a key into it, a unit as a replica is sent it,
-//! and a digest, its blobs hashed whole and hashed once (src/walk.zig).
+//! and a digest (src/walk.zig: a big text by its length).
//!
//! zig build rollback-bench -Dplatform=tui -Doptimize=ReleaseFast
const std = @import("std");
const libc = std.c;
const pardes = @import("pardes");
-const walk = pardes.walk;
const gpa = std.heap.c_allocator;
@@ -130,8 +129,7 @@ fn pct(samples: []u64, p: usize) u64 {
return samples[@min(samples.len - 1, samples.len * p / 100)];
}
-/// A unit of a key into a big file, and a digest, with its blobs hashed
-/// whole and hashed once.
+/// A unit of a key into a big file, and a digest.
fn digestBench(dir: []const u8, mb: usize) !void {
var path_buf: [512]u8 = undefined;
const path = try std.fmt.bufPrint(&path_buf, "{s}/big-file.txt", .{dir});
@@ -147,20 +145,15 @@ fn digestBench(dir: []const u8, mb: usize) !void {
_ = try a.unit(0, 0);
var unit_ns: [40]u64 = undefined;
var digest_ns: [40]u64 = undefined;
- for ([_]bool{ false, true }) |on| {
- walk.blob_words_on = on;
- defer walk.blob_words_on = true;
- walk.forgetAll();
- for (&unit_ns, &digest_ns, 0..) |*u, *d, k| {
- const t0 = nowNs();
- _ = try a.local(.{ .key = .{ .cp = if (k % 2 == 0) 'j' else 'k', .text = if (k % 2 == 0) "j" else "k" } });
- u.* = nowNs() - t0;
- const t1 = nowNs();
- _ = pardes.replica.digestOf(a);
- d.* = nowNs() - t1;
- }
- std.debug.print("{d} MB file, blobs {s}: a unit p50 {d} us p99 {d} us; a digest p50 {d} us p99 {d} us\n", .{ mb, if (on) "hashed once" else "hashed whole", pct(&unit_ns, 50) / 1000, pct(&unit_ns, 99) / 1000, pct(&digest_ns, 50) / 1000, pct(&digest_ns, 99) / 1000 });
+ for (&unit_ns, &digest_ns, 0..) |*u, *d, k| {
+ const t0 = nowNs();
+ _ = try a.local(.{ .key = .{ .cp = if (k % 2 == 0) 'j' else 'k', .text = if (k % 2 == 0) "j" else "k" } });
+ u.* = nowNs() - t0;
+ const t1 = nowNs();
+ _ = pardes.replica.digestOf(a);
+ d.* = nowNs() - t1;
}
+ std.debug.print("{d} MB file: a unit p50 {d} us p99 {d} us; a digest p50 {d} us p99 {d} us\n", .{ mb, pct(&unit_ns, 50) / 1000, pct(&unit_ns, 99) / 1000, pct(&digest_ns, 50) / 1000, pct(&digest_ns, 99) / 1000 });
}
pub fn main(init: std.process.Init) !void {