aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/benchmark
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
commitdcfe11a7588fcd42471159453810abc9b7720a57 (patch)
treec32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/src/benchmark
parent2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff)
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround. expose the new selection formatter and hyperlink uri apis for follow-up rendering work. add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/src/benchmark')
-rw-r--r--vendor/libghostty-vt/src/benchmark/AGENTS.md48
-rw-r--r--vendor/libghostty-vt/src/benchmark/TerminalParser.zig16
2 files changed, 59 insertions, 5 deletions
diff --git a/vendor/libghostty-vt/src/benchmark/AGENTS.md b/vendor/libghostty-vt/src/benchmark/AGENTS.md
new file mode 100644
index 00000000..bccefc12
--- /dev/null
+++ b/vendor/libghostty-vt/src/benchmark/AGENTS.md
@@ -0,0 +1,48 @@
+# Benchmarking
+
+The benchmark tools are split into two roles:
+
+- `ghostty-gen` generates synthetic input data.
+- `ghostty-bench` consumes existing input data and runs a benchmark.
+
+## Workflow
+
+- For timing comparisons, generate data first and benchmark it later.
+- Do not pipe `ghostty-gen` directly into `ghostty-bench` when comparing
+ performance. That mixes generation cost into the measurement and makes
+ branch-to-branch comparisons noisy.
+- Reuse the exact same generated files when comparing revisions.
+- Prefer deterministic generation inputs such as fixed seeds when the
+ generator supports them.
+- Keep large generated benchmark corpora outside the repository unless the
+ change explicitly requires checked-in test data.
+
+## Running Benchmarks
+
+- Prefer `hyperfine` to compare benchmark timings.
+- Benchmark the `ghostty-bench` command line, not the generator.
+- Use `ghostty-bench ... --data <path>` with pre-generated files.
+- Run multiple warmups and repeated measurements so branch comparisons are
+ based on medians instead of single runs.
+- When comparing branches, keep all benchmark inputs and CLI flags the same,
+ including terminal dimensions.
+- Never run multiple benchmarks in parallel on the same machine, as they will
+ interfere with each other and produce unreliable results.
+
+## Building
+
+- Build benchmark tools with `zig build -Demit-bench -Doptimize=ReleaseFast`.
+- On macOS, add `-Demit-macos-app=false` to avoid building the macOS app.
+- Make sure you specify `-Doptimize=ReleaseFast` when building benchmarks,
+ otherwise the debug build will be very slow and not representative of real
+ performance.
+
+## Comparing Branches
+
+- When comparing branches, switch to that branch, build the binary, then
+ rename it e.g. `zig-out/bin/ghostty-bench` to `zig-out/bin/ghostty-bench-branch1`.
+ Replace branch1 with something better.
+- Then switch to the other branch, build it, and rename it to
+ `zig-out/bin/ghostty-bench-branch2`. Replace branch2 with something better.
+- Then run all the benchmarks with `hyperfine` comparing the N binaries
+ we want to.
diff --git a/vendor/libghostty-vt/src/benchmark/TerminalParser.zig b/vendor/libghostty-vt/src/benchmark/TerminalParser.zig
index e0008176..78c93312 100644
--- a/vendor/libghostty-vt/src/benchmark/TerminalParser.zig
+++ b/vendor/libghostty-vt/src/benchmark/TerminalParser.zig
@@ -88,11 +88,17 @@ fn step(ptr: *anyopaque) Benchmark.Error!void {
return error.BenchmarkFailed;
};
if (n == 0) break; // EOF reached
- for (buf[0..n]) |c| {
- const actions = p.next(c);
- //std.log.warn("actions={any}", .{actions});
- _ = actions;
- }
+ parseAll(&p, buf[0..n]);
+ }
+}
+
+/// Separated from `step` so that the tight per-byte loop gets its own
+/// function alignment, insulating it from code-layout changes elsewhere
+/// in the binary that would otherwise shift its cache-line placement.
+noinline fn parseAll(p: *terminalpkg.Parser, data: []const u8) void {
+ for (data) |c| {
+ const actions = p.next(c);
+ _ = actions;
}
}