Skip to content

UI Performance: Use one sys-call for current time in render-loop - #2649

Merged
AmmarAbouZor merged 2 commits into
esrlabs:masterfrom
AmmarAbouZor:one_now_call_per_frame
Sep 23, 2026
Merged

AmmarAbouZor merged 2 commits into
esrlabs:masterfrom
AmmarAbouZor:one_now_call_per_frame

Conversation

@AmmarAbouZor

Copy link
Copy Markdown
Contributor

This PR improves UI performance by reducing system call to get the current time with Instant::now() to one call that will be owned by the main Host and will be updated on each egui::App::logic().

UI elements gets the time from the host directly
Action throttler receive the instant in it's signature as it doesn't live in the UI render loop.

This PR also fixes small bug in charts data requests reducing it's frequency on log count updates

* Use one time instant for all UI elements in render loop instead of
  each one of them making a system call with Instant::now() on their own.
* Main host owns this instant and will update on each App::logic() call
* Changes in UI components to call the method directly from `Host`
* Action throttler receive the instant in it's signature as it doesn't
  live in the UI render loop.
* Fallback for when it's called from outside UI thread is built by doing
  a sys-call for the current time at this state
* Interval updates recreated the throttle before it was queried, so the
  cool-down never applied. Use ActionThrottle::set_interval instead.
* Requests deferred by the cool-down now use the live plot bounds rather
  than replaying bounds the user already left.
@AmmarAbouZor
AmmarAbouZor merged commit 5bf35b3 into esrlabs:master Sep 23, 2026
1 check passed
@AmmarAbouZor
AmmarAbouZor deleted the one_now_call_per_frame branch September 23, 2026 20:16
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