Skip to content

Lay out the home cards' fixed texts only when they change - #24

Merged
Adiakys merged 1 commit into
mainfrom
perf/live-frame-cost
Nov 12, 2026
Merged

Adiakys merged 1 commit into
mainfrom
perf/live-frame-cost

Conversation

@Adiakys

@Adiakys Adiakys commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Profiling the app with devices moving (sampled stacks of the UI thread): about two thirds of the time is Slint drawing the whole window, a third is laying out text, and SimRig's own model code about 3%. Most of the text laid out was text that does not change: a card is one Device struct, rewritten on every live frame, so every text bound to it (name, brand, state chip, strength, rotation, the shifter layout, the handbrake state) was laid out again each time, font lookup included.

The cards' fixed texts now follow a local CardText, set from the same changed device handler as the press badge: a property set to an equal value marks nothing dirty, so they are laid out only when they change.

Simulated rig at 30 Hz, app CPU of one core:

Moving Before After
everything 9.2% 7.6%
base and wheel 4.8% 3.4%
pedals 4.0% 3.8%

What remains is mostly the redraw of the whole window on each frame (about 2.2% at 30 Hz with nothing changing), which FemtoVG does on every frame.

@Adiakys
Adiakys merged commit 7b6c94d into main Nov 12, 2026
2 checks passed
@Adiakys
Adiakys deleted the perf/live-frame-cost branch November 12, 2026 21:11
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