summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pardes.zig1
-rw-r--r--src/syntax.zig11
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 }{