# gpui: Lazy-init font DB in SvgRenderer to avoid per-test overhead \(\#53381\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bf102668bee6b7519ec5ee17f561d3f7be6d9c9e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bf102668bee6b7519ec5ee17f561d3f7be6d9c9e

Requested commit: bf102668bee6b7519ec5ee17f561d3f7be6d9c9e

Commit: bf102668bee6b7519ec5ee17f561d3f7be6d9c9e

Tree: 5a1d00c07cf8ab60659989883a46384b7a33ce28

Author: Lukas Wirth

Committer: GitHub

## Message

```
gpui: Lazy-init font DB in SvgRenderer to avoid per-test overhead (#53381)

Commit eaf14d028a6c changed SvgRenderer::new() to eagerly deep-clone the
system font database and enrich it with bundled fonts at construction
time. Since every #[gpui::test] creates a TestAppContext →
App::new_app() → SvgRenderer::new(), and nextest runs each test in its
own process, this added ~2-3s of overhead to every GPUI-based test (~132
minutes total across the full suite).

Move the expensive work (deep-clone + load_bundled_fonts +
fix_generic_font_families) into a OnceLock inside the font resolver
closure, so it only executes on the first actual SVG render. Tests that
never render SVGs thus do not need to load the fonts which in itself can
be fairly expensive.

This also bumps the opt-level for crane lift and some other wasmtime
crates, as only wasmtime isn't really sufficient

Release Notes:

- N/A or Added/Fixed/Improved ...
```

## Parents

- [a0a74019a86929dd3f9c90f326c43c3c32e3b3f6](https://git.cafe/gitcafe/zed/commit/a0a74019a86929dd3f9c90f326c43c3c32e3b3f6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bf102668bee6b7519ec5ee17f561d3f7be6d9c9e?format=markdown)
