diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-28 13:21:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | 0b5ad7a30ba9e7c6eedcb426be294bd94219310f (patch) | |
| tree | 1a991acfb2a14f25ece19e13e65915dbbb48c7fc /src | |
| parent | 95202b9b22751c86f100aae9ff1c64e535dcbd70 (diff) | |
| download | pardes-0b5ad7a30ba9e7c6eedcb426be294bd94219310f.tar.gz pardes-0b5ad7a30ba9e7c6eedcb426be294bd94219310f.zip | |
build.zig runners and testing improvements
Diffstat (limited to 'src')
| -rw-r--r-- | src/pardes.zig | 1 | ||||
| -rw-r--r-- | src/syntax.zig | 11 |
2 files changed, 5 insertions, 7 deletions
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 }{ |
