[PR #15239] [MERGED] Avoid loading nearby fonts unless necessary #30530

Open
opened 2026-01-31 09:41:23 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/15239
Author: @lhecker
Created: 4/26/2023
Status: Merged
Merged: 5/3/2023
Merged by: @microsoft-github-policy-service[bot]

Base: mainHead: dev/lhecker/startup-perf-nearby-fonts


📝 Commits (1)

  • 615dccd Avoid loading nearby fonts unless necessary

📊 Changes

9 files changed (+109 additions, -91 deletions)

View changed files

📝 src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp (+5 -1)
📝 src/inc/til/mutex.h (+5 -4)
📝 src/renderer/atlas/AtlasEngine.api.cpp (+12 -1)
📝 src/renderer/atlas/pch.h (+2 -1)
📝 src/renderer/base/FontCache.h (+27 -33)
📝 src/renderer/dx/DxFontInfo.cpp (+33 -24)
📝 src/renderer/dx/DxFontInfo.h (+12 -12)
📝 src/renderer/dx/DxFontRenderData.cpp (+13 -14)
📝 src/renderer/dx/DxFontRenderData.h (+0 -1)

📄 Description

IDWriteFontSetBuilder is super expensive (~40ms of CPU for building a
single font set on a high-end CPU from ~2021). Let's avoid the cost,
by only constructing it if Cascadia Code is actually missing.
To not overcomplicate the code and to support any additional fonts we
might ship in the future, I'm not checking for the font name, and
instead I just construct the font set whenever any font is missing.

Part of #5907

Validation Steps Performed

  • Breakpoints in FontCache aren't hit
  • App doesn't crash

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/15239 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 4/26/2023 **Status:** ✅ Merged **Merged:** 5/3/2023 **Merged by:** [@microsoft-github-policy-service[bot]](https://github.com/apps/microsoft-github-policy-service) **Base:** `main` ← **Head:** `dev/lhecker/startup-perf-nearby-fonts` --- ### 📝 Commits (1) - [`615dccd`](https://github.com/microsoft/terminal/commit/615dccdbe30bd575afa6f9408354d68ba8f8b998) Avoid loading nearby fonts unless necessary ### 📊 Changes **9 files changed** (+109 additions, -91 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp` (+5 -1) 📝 `src/inc/til/mutex.h` (+5 -4) 📝 `src/renderer/atlas/AtlasEngine.api.cpp` (+12 -1) 📝 `src/renderer/atlas/pch.h` (+2 -1) 📝 `src/renderer/base/FontCache.h` (+27 -33) 📝 `src/renderer/dx/DxFontInfo.cpp` (+33 -24) 📝 `src/renderer/dx/DxFontInfo.h` (+12 -12) 📝 `src/renderer/dx/DxFontRenderData.cpp` (+13 -14) 📝 `src/renderer/dx/DxFontRenderData.h` (+0 -1) </details> ### 📄 Description `IDWriteFontSetBuilder` is super expensive (~40ms of CPU for building a single font set on a high-end CPU from ~2021). Let's avoid the cost, by only constructing it if Cascadia Code is actually missing. To not overcomplicate the code and to support any additional fonts we might ship in the future, I'm not checking for the font name, and instead I just construct the font set whenever any font is missing. Part of #5907 ## Validation Steps Performed * Breakpoints in FontCache aren't hit ✅ * App doesn't crash ✅ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:41:23 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30530