diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 09:51:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | a380608d79ec755e857a5b5e7bacc96e6720efd5 (patch) | |
| tree | 55b69ae91f670b2e5f94a1b9022a4ce718464124 | |
| parent | aecc0e8e8979f9afb5cadb7e509bb0cd9b211d0a (diff) | |
| download | sketchbook-a380608d79ec755e857a5b5e7bacc96e6720efd5.tar.gz sketchbook-a380608d79ec755e857a5b5e7bacc96e6720efd5.zip | |
build: the text library is optimised in every mode: FreeType and HarfBuzz are not what a Debug build debugs, and at -O0 a layout cost four to six times as much (a screen of source text laid out and drawn a frame: 2.9 ms in a Debug host, 0.6 ms with this); a ReleaseSafe or ReleaseSmall build keeps its own mode; zig build test 192/192 steps, test-text 52/52, every picture as it was
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | build.zig | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -681,7 +681,11 @@ fn cModule(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Optimi /// host links it, and so do a sketch's tests (`App.addTest`), which measure /// text with no host; a sketch's library never does. Null until the lazy /// packages are fetched. -fn textLibrary(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) ?*Build.Step.Compile { +fn textLibrary(b: *Build, target: Build.ResolvedTarget, mode: std.builtin.OptimizeMode) ?*Build.Step.Compile { + // FreeType and HarfBuzz are not what a Debug build debugs, and at -O0 a + // layout costs four to six times as much (a screen of source text laid + // out twice a frame: 2.9 ms against 0.6): optimised in every mode. + const optimize: std.builtin.OptimizeMode = if (mode == .debug) .ReleaseFast else mode; const freetype = (b.lazyDependency("freetype", .{ .target = target, .optimize = optimize, .@"enable-libpng" = false }) orelse return null).artifact("freetype"); const harfbuzz = b.lazyDependency("harfbuzz", .{}) orelse return null; const lib = b.addLibrary(.{ .name = "sketchbook-text", .linkage = .static, .root_module = b.createModule(.{ |
