From 0b5ad7a30ba9e7c6eedcb426be294bd94219310f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 28 Jul 2026 13:21:42 -0300 Subject: build.zig runners and testing improvements --- src/pardes.zig | 1 - src/syntax.zig | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pardes.zig b/src/pardes.zig index 8e644470..731dfe0a 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -970,7 +970,6 @@ pub const Pardes = struct { scratch: std.heap.ArenaAllocator, pub fn init(gpa: std.mem.Allocator, opts: Options) !*Pardes { - syntax.compileStartupQueries(); const p = try gpa.create(Pardes); p.* = .{ .gpa = gpa, .opts = opts, .screen_w = opts.cols, .screen_h = opts.rows, .scratch = .init(gpa) }; if (opts.file) |path| { diff --git a/src/syntax.zig b/src/syntax.zig index bbab17fa..43e370d5 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -120,12 +120,11 @@ fn forExt(ext: []const u8) !?Selected { return null; } -/// Compile the compact-tier queries eagerly so the first source open is fast. -pub fn compileStartupQueries() void { - if (!enabled) return; - for (&zig_specs) |*spec| _ = ensure(spec) catch {}; - for (&minimal_specs) |*spec| _ = ensure(spec) catch {}; -} +// Queries compile on first use (`ensure`), never at startup. Pre-compiling the +// compact tier in Pardes.init cost EVERY boot ~120ms of ts_query__perform_analysis +// (55% of a Debug startup) to save ~40ms on the first .zig/.c/.cpp open — a pane +// of prose or a shell paid for a language it never opened. Grammar availability +// is unchanged; only the timing moved. fn synFor(name: []const u8) Syn { for ([_]struct { []const u8, Syn }{ -- cgit v1.3