Skip to content

Open in about a second: setup's state no longer waits on the inactive Wine app - #841

Merged
aaf2tbz merged 2 commits into
mainfrom
perf/startup-refresh
Nov 26, 2026
Merged

aaf2tbz merged 2 commits into
mainfrom
perf/startup-refresh

Conversation

@aaf2tbz

@aaf2tbz aaf2tbz commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

MetalSharp took about 21 s from launch to a loaded library on a FEX install with the x86_64 runtime installed too. Now it takes about 1.1 s (1.15, 1.16 and 1.08 s over three cold launches of the FEX build).

Why it was slow

The backend's startup refreshes run on threads of their own. While they run, /setup/state waits for them (ms_wine_refresh_wait). The backend answers one request at a time, so the window's first load waited too. The wait covered the inactive runtime's Wine app as well (ms_wine_refresh_inactive_app): at best a codesign --verify --deep --strict of a 4.4 GB app, plus a chmod -R.

On the FEX build, the x86_64 app's source (app_source) is the installed runtime/MetalSharp-Wine-x86_64.app itself, since MetalSharp.app doesn't carry one. When that installed app fails its deep check, install_app_locked copied it onto itself (ditto, then cp -Rp) on every launch. The copy failed its check too, after about 20 s of holding the UI, and logs/setup-metalsharp-wine.log grew with "a sealed resource is missing or invalid" each time.

Changes

  • refresh_thread (FEX) and x86_64_refresh_thread (regular) end the refresh gate once the active runtime is laid out. They refresh the other runtime's app after that, so setup's state no longer waits on it. That app only replaces the one kept aside and lays nothing out, so setup's state doesn't depend on it.
  • install_app_locked leaves an app alone when its source is the installed app itself. Nothing newer exists to install from, and a copy onto itself can't fix it.
  • wine_runtime_test.c checks that an installed app that is its own source installs without a staging copy. The test fails on main and passes here.
  • A CHANGELOG line, under Unreleased › Fixed.

Testing

  • make -C app/src-c test, and the same with VARIANT=fex BUILD_DIR=…/build-fex: both pass.
  • FEX build installed over 1.5.0, three cold launches: 1.15, 1.16 and 1.08 s from open to "Loaded Steam library". main took about 21 s on the same machine. A sample of the app's main thread during startup shows it idle.

Merging

#838 also opens an Unreleased section in CHANGELOG.md. Whichever merges second needs its entry moved under the other's heading.

The startup refreshes held setup's state until the other runtime's Wine app
was refreshed too, a deep signature check of a 4.4 GB app at best. On the FEX
build the x86_64 app's source is the installed app itself, so a damaged one was
copied onto itself on every launch and failed, holding the UI for ~20 s.

Setup's state now waits only for the active runtime, and an app is never
reinstalled from itself.
@aaf2tbz
aaf2tbz merged commit 7ef788d into main Nov 26, 2026
6 checks passed
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