summaryrefslogtreecommitdiff
path: root/src/walk.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 02:43:58 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit2536110e142a3cb548a43235767ac7ae6efa357c (patch)
tree2248f07ef7f7895bbb0ac4bf40981e8c411f6700 /src/walk.zig
parenta27c2cb3846a6e2db28250600d762d19c1006eaf (diff)
downloadpardes-2536110e142a3cb548a43235767ac7ae6efa357c.tar.gz
pardes-2536110e142a3cb548a43235767ac7ae6efa357c.zip
walk: the tape's shape appends each piece whole: `out = out ++ name ++ ":" ++ shapeOf(F) ++ ","` is ((out ++ name) ++ ":") ++ ..., so the shape so far (up to 11 KB, every union arm and struct field of the tape's types) was copied at comptime once a piece, four times a field, and a comptime copy is costly (32 KB built of 4,000 appends: 226e9 of the compiler's instructions); the piece is put together first and appended once, in shape (each type's line), an enum's values, a struct's and a union's fields; the shape is the same 10,960 bytes and wire.semantics the same 05b2cba8834b1d7c; core-test's forced full recompile (Debug, one filter) 103.41e9 to 101.37e9 instructions (-1.7 % of the base's 120.12e9; all five changes together -15.6 %, 15.5-16.1 s of CPU to 13.6-14.4 s, and 9.0-9.2 s wall against 10.2-11.0 s, both noisy), the Debug test's text unchanged; a session's byte dump, its image and a closed pane's save the same bytes (but the clock's) and each build loads the other's; the changelog says so
Diffstat (limited to 'src/walk.zig')
-rw-r--r--src/walk.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/walk.zig b/src/walk.zig
index 8747937d..0f181cfa 100644
--- a/src/walk.zig
+++ b/src/walk.zig
@@ -367,7 +367,7 @@ pub fn shape(comptime types: []const type) []const u8 {
comptime {
@setEvalBranchQuota(10_000_000);
var out: []const u8 = "";
- for (types) |T| out = out ++ shapeOf(T, 0) ++ "\n";
+ for (types) |T| out = out ++ (shapeOf(T, 0) ++ "\n");
return out;
}
}
@@ -382,7 +382,7 @@ fn shapeOf(comptime T: type, comptime depth: u8) []const u8 {
.float => |f| "f" ++ decimal(f.bits),
.@"enum" => |e| blk: {
var out: []const u8 = shapeOf(e.tag_type, depth + 1) ++ "{";
- for (e.field_names, e.field_values) |n, v| out = out ++ n ++ "=" ++ decimal(v) ++ ",";
+ for (e.field_names, e.field_values) |n, v| out = out ++ (n ++ "=" ++ decimal(v) ++ ",");
break :blk out ++ "}";
},
.optional => |o| if (machinery(o.child)) "0" else "?" ++ shapeOf(o.child, depth + 1),
@@ -397,13 +397,13 @@ fn shapeOf(comptime T: type, comptime depth: u8) []const u8 {
var out: []const u8 = if (s.layout == .@"packed") "p{" else "{";
for (s.field_names, s.field_types, s.field_attrs) |name, F, attr| {
if (attr.@"comptime" or excluded(T, name)) continue;
- out = out ++ name ++ ":" ++ shapeOf(F, depth + 1) ++ ",";
+ out = out ++ (name ++ ":" ++ shapeOf(F, depth + 1) ++ ",");
}
break :blk out ++ "}";
},
.@"union" => |u| blk: {
var out: []const u8 = shapeOf(u.tag_type.?, depth + 1) ++ "(";
- for (u.field_names, u.field_types) |name, F| out = out ++ name ++ ":" ++ shapeOf(F, depth + 1) ++ ",";
+ for (u.field_names, u.field_types) |name, F| out = out ++ (name ++ ":" ++ shapeOf(F, depth + 1) ++ ",");
break :blk out ++ ")";
},
.error_set => "error",