From 931a538a3992c0f33c6647360bd15ff54f0f7a87 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Aug 2026 20:22:28 -0700 Subject: [PATCH] comments --- src/App.zig | 17 ++--------------- src/renderer/Metal.zig | 6 ------ 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/App.zig b/src/App.zig index 15e06a03a..28bbd83f1 100644 --- a/src/App.zig +++ b/src/App.zig @@ -79,21 +79,6 @@ pub fn create(alloc: Allocator) CreateError!*App { errdefer alloc.destroy(app); try app.init(alloc); - // Warm up system services on background threads. These are - // multi-millisecond one-time costs that would otherwise be paid - // during the first surface's initialization. Doing it here overlaps - // them with the rest of app startup (config, app runtime, window - // creation). - threadedWarmup(); - - return app; -} - -/// Warm up system services whose first use in a process is slow. Each -/// subsystem gets its own background thread so that one slow subsystem -/// doesn't delay the others. Only operations that are safe to run on -/// any thread belong here. -fn threadedWarmup() void { // If font discovery supports warmup, then we call it. Some font // mechanisms (e.g. CoreText) have a multi-millisecond one-time cost // on startup. @@ -118,6 +103,8 @@ fn threadedWarmup() void { log.warn("renderer warmup thread spawn failed err={}", .{err}); } } + + return app; } /// Initialize the main app instance. This creates the main window, sets diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 7b59ce500..9247454db 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -413,12 +413,6 @@ pub inline fn beginFrame( /// thread at app startup; Metal device queries are thread-safe) moves /// that one-time cost off the critical path of the first surface's /// renderer initialization. -/// -/// We deliberately do NOT cache the chosen device: the device set can -/// change at runtime (e.g. an eGPU being plugged in or removed) and -/// chooseDevice prefers removable GPUs, so every renderer init must -/// re-choose. Only the underlying framework initialization is a -/// one-time cost. pub fn warmup() void { const device = chooseDevice() catch return; defer device.release();