From 4e224b7c7e67fafcbe7359fcf534048e254b701d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 13:19:08 -0300 Subject: The theme's chrome is worked out once, not per grapheme; still post passes let the GUI rest; a perf gate somtrmsz's contrast floors made ChromeTheme.fromTheme run its focus-tint and separator searches (pow calls each), and Output's RowDecoration.styleAt called it for every grapheme of every highlighted row: the 50k-line file's render went from 0.11 ms to 13 ms. Pardes.bodyChrome now keeps the theme's chrome, worked out again only when the theme differs; recolorSyntax asks for it once a decorated row, and a plain row (nearly every row of a file) never asks. ReleaseFast, medium fixture, median us, before -> after (main): render 13150 -> 76 (111), key-down 14658 -> 79 (110), wheel 13589 -> 76 (109), open 14891 -> 2095 (2055), edit-char 16703 -> 3006 (1251; the rest of that gap is editing and tree-sitter, not this). Post.animating asked for frames whenever the window had focus and any pass was ready, so a still pass kept the GUI drawing at the display's rate (Bloom: 49% of a core idle, in a hidden test window). A pass now says whether it moves on its own: the CRT (its hum and dither) and a Shadertoy file whose source reads iTime, iFrame or iDate (shader_build.readsTime; the flag rides the wire's post message); Bloom, Vignette and Grain are still. Bloom idle: 49% -> 1.2%, as with no pass. zig build perf-gate: the 50k-line file's gestures, each's fastest sample within 3x of the recorded baseline's (test/perf-baseline-- .json, recorded from this build), run with every unit-test. On the regressed code it fails at 180x for render. --- src/detached/wire.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/detached') diff --git a/src/detached/wire.zig b/src/detached/wire.zig index ee8c72fb..15d3641c 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -1178,6 +1178,7 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 { // 0 a file, else a bundled scene and one. try w.putByte(if (pass.scene) |scene| @as(u8, @intFromEnum(scene)) + 1 else 0); try w.putByte(pass.level); + try w.putByte(@intFromBool(pass.animated)); try w.putU32(pass.revision); try w.putSlice16(pass.path); try w.putSlice32(pass.spirv); @@ -1206,7 +1207,7 @@ pub fn serverBound(msg: ServerMsg) usize { .open_link => |u| u.len, .post => |p| blk: { var n: usize = 0; - for (p.list()) |pass| n += 12 + pass.path.len + pass.spirv.len; + for (p.list()) |pass| n += 13 + pass.path.len + pass.spirv.len; break :blk n; }, }; @@ -1280,6 +1281,11 @@ pub fn decodeServer(tag: u8, payload: []const u8) Error!ServerMsg { pass.* = .{ .scene = if (kind == 0) null else std.enums.fromInt(Scene, kind - 1) orelse return error.BadValue, .level = try r.getByte(), + .animated = switch (try r.getByte()) { + 0 => false, + 1 => true, + else => return error.BadValue, + }, .revision = try r.getU32(), .path = try r.getSlice16(), .spirv = try r.getSlice32(), @@ -1406,7 +1412,7 @@ test "detached wire: every server message round-trips" { try testing.expectEqualStrings("https://x", (try roundServer(&buf, .{ .open_link = "https://x" })).open_link); var chain: Post = .{ .animation = .always, .len = 2 }; chain.passes[0] = .{ .scene = .bloom, .level = 3 }; - chain.passes[1] = .{ .path = "~/wave.glsl", .spirv = "\x03\x02\x23\x07spirv", .revision = 7 }; + chain.passes[1] = .{ .path = "~/wave.glsl", .spirv = "\x03\x02\x23\x07spirv", .revision = 7, .animated = true }; const back = (try roundServer(&buf, .{ .post = chain })).post; try testing.expectEqual(ShaderAnimation.always, back.animation); try testing.expectEqual(@as(u8, 2), back.len); @@ -1416,6 +1422,7 @@ test "detached wire: every server message round-trips" { try testing.expectEqualStrings("~/wave.glsl", back.passes[1].path); try testing.expectEqualStrings("\x03\x02\x23\x07spirv", back.passes[1].spirv); try testing.expectEqual(@as(u32, 7), back.passes[1].revision); + try testing.expect(back.passes[1].animated and !back.passes[0].animated); } test "detached wire: only the display's own effects are on the wire" { -- cgit v1.3