From de4def3548a6729b0dfd2120495a61beef8c8c2c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 5 Jul 2026 20:21:50 -0300 Subject: pardes v2: the rewrite, complete and organized. src/ (core + three shells), test/ (snapshot parity harness + 18 frozen goldens). One sans-IO core, vaxis tty + SDL3 GPU native + wasm web shells, 18/18 parity with the purged prototype, 7.6k lines vs 12.1k. Fix: gui shell pre-sized the core at init so the greet-releasing resize never fired (blank panes until first interaction); live sessions now init at defaults and get the real grid as a resize event (the shell contract, documented on Options). --- tests_tty_perf.zig | 88 ------------------------------------------------------ 1 file changed, 88 deletions(-) delete mode 100644 tests_tty_perf.zig (limited to 'tests_tty_perf.zig') diff --git a/tests_tty_perf.zig b/tests_tty_perf.zig deleted file mode 100644 index 06ce9cc3..00000000 --- a/tests_tty_perf.zig +++ /dev/null @@ -1,88 +0,0 @@ -const std = @import("std"); -const h = @import("e2e_harness.zig"); - -const Harness = h.Harness; -const linux = std.os.linux; - -const samples = 5; -const payload_len = 64; - -fn nowNs() u64 { - var ts: linux.timespec = undefined; - _ = linux.clock_gettime(linux.CLOCK.MONOTONIC, &ts); - return @intCast(ts.sec * 1_000_000_000 + ts.nsec); -} - -fn fillPayload(buf: *[payload_len]u8, sample: usize) []const u8 { - const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - for (buf, 0..) |*ch, i| ch.* = alphabet[(i + sample * 13) % alphabet.len]; - - var marker_buf: [16]u8 = undefined; - const marker = std.fmt.bufPrint(&marker_buf, "ZTPERF{d}END", .{sample}) catch unreachable; - const start = payload_len - marker.len; - @memcpy(buf[start..][0..marker.len], marker); - return buf[start..payload_len]; -} - -fn clickBodyRow(hs: *Harness, screen_row: usize) !void { - var seq_buf: [64]u8 = undefined; - const seq = try std.fmt.bufPrint(&seq_buf, "\x1b[<0;3;{d}M\x1b[<0;3;{d}m", .{ screen_row, screen_row }); - try hs.send(seq); -} - -pub fn main(init: std.process.Init) !void { - const gpa = init.gpa; - const args = try init.minimal.args.toSlice(init.arena.allocator()); - if (args.len != 2) { - std.debug.print("usage: {s} \n", .{args[0]}); - return error.BadArgs; - } - - var hs = try Harness.initArgs(gpa, args[1].ptr, 24, 80, "--tty"); - defer hs.deinit(); - - try hs.expectWaitFor("sy /", 6000, "--tty did not start in tty mode"); - try hs.send("clear\r"); - try hs.pump(900); - try hs.send("\x02"); - try hs.expectWaitFor("nm /", 6000, "Ctrl-b did not leave tty mode"); - - var best_us: u64 = std.math.maxInt(u64); - var total_us: u64 = 0; - - std.debug.print("tty-edit-perf backend=vaxis samples={d} chars_per_sample={d}\n", .{ samples, payload_len }); - - var sample: usize = 0; - while (sample < samples) : (sample += 1) { - const row = 5 + sample * 3; - try clickBodyRow(&hs, row); - try hs.pump(80); - try hs.send("i"); - try hs.expectWaitFor("in /", 3000, "failed to enter insert mode"); - - var payload_buf: [payload_len]u8 = undefined; - const marker = fillPayload(&payload_buf, sample); - - const t0 = nowNs(); - try hs.send(&payload_buf); - try hs.expectWaitFor(marker, 10_000, "typed marker never appeared"); - const elapsed_us = (nowNs() - t0) / 1000; - - best_us = @min(best_us, elapsed_us); - total_us += elapsed_us; - std.debug.print(" sample {d}: elapsed_us={d} us_per_char={d}\n", .{ - sample + 1, - elapsed_us, - elapsed_us / payload_len, - }); - - try hs.send("\x1b"); - try hs.expectWaitFor("nm /", 3000, "failed to leave insert mode"); - } - - std.debug.print("tty-edit-perf summary: best_us={d} avg_us={d} best_us_per_char={d}\n", .{ - best_us, - total_us / samples, - best_us / payload_len, - }); -} -- cgit v1.3