From 3f680abbe2c4d2eeefd0eb73b8af25d1768e6ceb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 30 Jun 2021 18:03:54 -0700 Subject: stage2: tokenizer: require null terminated source By requiring the source file to be null-terminated, we avoid extra branching while simplifying the logic at the same time. Running ast-check on a large zig source file (udivmodti4_test.zig), master branch compared to this commit: * 4% faster wall clock * 7% fewer cache misses * 1% fewer branches --- src/Compilation.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index c1cca84f62..68a008e0e1 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1541,7 +1541,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { } } - if (comp.bin_file.options.use_stage1) { + if (comp.bin_file.options.use_stage1 and comp.bin_file.options.module != null) { try comp.work_queue.writeItem(.{ .stage1_module = {} }); } -- cgit v1.2.3