This commit is contained in:
Mitchell Hashimoto
2026-08-09 20:22:28 -07:00
parent da745630be
commit 931a538a39
2 changed files with 2 additions and 21 deletions

View File

@@ -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

View File

@@ -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();