Skip to content

perf(gui): create the Vulkan instance while startup work runs - #379

Closed
chrispository wants to merge 2 commits into
thisisgm:mainfrom
chrispository:perf/prewarm-vulkan-instance
Closed

chrispository wants to merge 2 commits into
thisisgm:mainfrom
chrispository:perf/prewarm-vulkan-instance

Conversation

@chrispository

@chrispository chrispository commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This will need to wait until after these are merged, then repoint this to the main flea repo.

thisisgm/gpui-omarchy#4
thisisgm/gpui-omarchy#5

Summary

Stacked on #378. Review that one first. This PR's own change is the last commit.

This calls the new gpui_platform::prewarm_gpu() before the locale and settings work in main. The Vulkan driver then loads on a background thread while startup work runs, instead of after it.

Numbers

RTX 4090, Hyprland 0.56.2, interleaved launches, untraced medians.

This commit, on top of #378 (8 rounds; the same binary with the prewarm switched on and off):

#378 only + prewarm Change
Window mapped 189.2 ms 176.9 ms −12.3 ms (−6.5%)
renderer_new (traced) 150.2 ms 121.8 ms −28.4 ms (−18.9%)

Both PRs against current main: window mapped 210.7 → 176.9 ms, −33.8 ms (−16.0%). The two results come from separate sessions. They line up, though: the "#378 only" figure (189.2 ms) matches what #378 measured against main in the first session (189.4 ms).

Where to call it: I also measured other places for the call. The first line of main gave 176.2 ms, no better than the chosen spot. Calling it after the settings worker spawns gave 186.1 ms, losing most of the gain. The current spot is right after backend log setup, before Service::launch.

What's left

About 100 ms of NVIDIA driver work is still on the critical path: driver load/init (~30–46 ms), then vkCreateDevice (~60–75 ms). A standalone C probe gave the same numbers. Possible follow-ups, not in this PR:

  • Early draw: a ~9 ms GPUI draw that runs before the compositor's first configure.
  • Surface check: a ~13 ms 64×64 test surface configure.

Diff

crates/flea-gui/src/main.rs +3 (one call plus a comment), plus the pin bump. cargo check -p flea-gui --locked passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Graphics resources are prepared earlier in the launch process, before locale and settings work begins. This changes the order of startup operations without adding new controls or changing the app’s available features. The update may affect when graphics initialization occurs during launch, while the rest of the startup flow remains unchanged.

chrispository and others added 2 commits November 3, 2026 19:26
Pin GPUI to chrispository/gpui-omarchy perf/initial-window-background
(c3a7c8c, based on the current pin 04965e8). The Wayland renderer now starts
in the alpha mode of the window's initial background and decorations, so
opening a window builds its pipelines once instead of three times.

Interleaved launches (RTX 4090, Hyprland): window map median 210.7 -> 189.4 ms.
No visual change in Omarchy's opaque, transparent or glassy modes, either at
open or when switching while open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pin GPUI to chrispository/gpui-omarchy perf/window-open-stack (4d64d59: the
final-alpha-mode change plus a Vulkan instance prewarm) and start the prewarm
before locale and settings work, so the driver load overlaps them instead of
following them.

Interleaved launches (RTX 4090, Hyprland), on top of the alpha-mode change:
window map median 189.2 -> 176.9 ms. Starting it at the top of main measured
the same; starting it after the settings worker spawns measured 186.1 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The workspace GPUI dependencies now use the chrispository/gpui-omarchy fork. The application calls gpui_platform::prewarm_gpu() before locale and settings initialization.

Changes: GPU startup initialization

Layer / File(s) Summary
GPU dependency and startup setup
Cargo.toml, crates/flea-gui/src/main.rs
The workspace GPUI dependencies now use the new fork and revision. main prewarms the GPU before locale and settings initialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related issues

  • thisisgm/flea#376: The change adds an earlier GPU prewarm call, but does not address the issue’s reported NVIDIA adapter enumeration or GPU selection behavior.

Suggested reviewers: thisisgm

Merge Risk: Minimal · up to 58489

The change overlaps GPU initialization with startup work while retaining renderer fallback behavior. No actionable blocker was found; it is mergeable subject to normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description covers the change and its motivation. It states the call to gpui_platform::prewarm_gpu() before locale and settings work, and it links the stacked PR #378 and the GPUI dependencies (th… Rewrite the description to follow the template headings: '## What and why', '## Proof', and '## Checks'. In 'What and why', link the related issue with a 'Fixes #' line, or state that no issue exists. Keep the performance numbers under 'Pro…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: prewarming Vulkan during startup work to improve GUI launch performance.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Description check

Explanation

The description covers the change and its motivation. It states the call to gpui_platform::prewarm_gpu() before locale and settings work, and it links the stacked PR #378 and the GPUI dependencies (thisisgm/gpui-omarchy#4 and #5). It reports benchmark numbers, the pin, and that cargo check -p flea-gui --locked passes. It does not follow the repository template. The 'What and why' section has no 'Fixes #' issue link. The 'Proof' section has no before/after screenshot or recording, and the benchmark timings are not a visual proof. The 'Checks' list is absent: the rebase on latest main is not confirmed, ./tests/run-all.sh is not reported, and the hand test on Omarchy is not reported. The description is detailed, but it skips required template items.

Resolution

Rewrite the description to follow the template headings: '## What and why', '## Proof', and '## Checks'. In 'What and why', link the related issue with a 'Fixes #' line, or state that no issue exists. Keep the performance numbers under 'Proof'. Add a before and after screenshot or recording for any visible change, or state that no visible change exists. Under 'Checks', mark each item. Confirm the branch is rebased on latest main. Confirm ./tests/run-all.sh passes, or explain why it was not run. Confirm the manual test on Omarchy in each affected view, or state that it has not been done. Note that the PR depends on the unmerged thisisgm GPUI PRs and on the stacked #378, and say how the pin will change after they merge.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.0)

Clippy execution timed out

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7309cbd-39fc-4880-8774-d07e91751b11
Commits

Reviewing files that changed from the base of the PR and between 73f3c23 and 58489f5.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 2
  • Cargo.toml
  • crates/flea-gui/src/main.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@chrispository

Copy link
Copy Markdown
Contributor Author

Superseded by #381, which combines #378 and #379 with the parallel-pipelines change, now pinned to thisisgm/gpui-omarchy#7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant