From b7e843256982f5a22954d103bb40264daf2bb758 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 21 Nov 2026 21:01:04 -0300 Subject: layers: a terminal's output pays less for the layers with `Changes` off: `jj.paint` is called never inlined from `body_layer.renderBody` (inlined, it grew renderBody's own frame, which every body of every frame pays, a terminal's too, though no terminal reaches the call); measured, a variant at a time, the gate's perfops in its own layout (`perf/tops.sh`: all 121 counts of the candidate's pardes-perf against tree3's): `terminal on all` on item 0 +0.083% (merge50 before round 3: +0.026%; round 3 alone: +0.259%), with `Changes`'s jj session behind a pointer +0.082% (not kept), with the paint call gone +0.050%, with no `Changes` builtin as well +0.050% (the builtin costs nothing), with the call kept but never inlined +0.050% (this change), with no `Surface.lanes` as well +0.047% (not kept: 3,000 instructions an operation); the rest over merge50, about 25,000 instructions an operation, is not found yet Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/body_layer.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/body_layer.zig b/core/body_layer.zig index 28b86f78..78b8e0b9 100644 --- a/core/body_layer.zig +++ b/core/body_layer.zig @@ -338,7 +338,9 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane // File layout is independent of whether its producer requests colors. if (pane.file) |*f| { drawGutter(p, s, pane, r, tx, tw, body_h, active); - if (pane.layers.lanes > 0) @import("jj.zig").paint(p, s, pane, r, tx, tw, body_h); + // Never inlined: in renderBody's own frame it cost every body a + // frame (a terminal's output about 33,000 instructions a pump). + if (pane.layers.lanes > 0) @call(.never_inline, @import("jj.zig").paint, .{ p, s, pane, r, tx, tw, body_h }); panes.Query.paintMark(p, s, pane, r, body_h); if (pane.colorAlgo() != .none) panes.File.recolorSyntax(p, s, pane, f, r, tx, tw, body_h); -- cgit v1.3