Skip to content

Conversation

@TheSecurityDev
Copy link
Contributor

@TheSecurityDev TheSecurityDev commented Nov 19, 2025

Avoid the overhead of loading all the big UI layouts on mici and vice-versa.

Copilot AI review requested due to automatic review settings November 19, 2025 17:29
@github-actions github-actions bot added the ui label Nov 19, 2025
Copilot finished reviewing on behalf of TheSecurityDev November 19, 2025 17:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes UI module loading by moving layout imports from module-level to conditional imports within the main() function. This ensures that only the relevant UI layout (MainLayout for TICI/TIZI devices, or MiciMainLayout for smaller devices) is loaded based on the hardware type, avoiding the overhead of importing unused large UI modules.

Key changes:

  • Removed top-level imports of MainLayout and MiciMainLayout
  • Added conditional imports inside main() based on gui_app.big_ui() check

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

raylib UI Preview

All Screenshots

@TheSecurityDev
Copy link
Contributor Author

Will update to do this for setup, updater, reset layout imports also

@adeebshihadeh
Copy link
Contributor

adeebshihadeh commented Nov 19, 2025

Does this actually make a difference? You can check with PROFILE_STARTUP=1.

@TheSecurityDev TheSecurityDev changed the title ui: only import main layout that's used ui: only import layouts that are used Nov 19, 2025
@TheSecurityDev
Copy link
Contributor Author

Does this actually make a difference? You can check with PROFILE_STARTUP=1.

I can't find any measurable startup speed difference. Using memory-profiler shows a couple MB of memory savings. It just seemed the logical thing to do, but maybe it's not necessary.

@adeebshihadeh
Copy link
Contributor

If it makes zero difference, this PR has been a net negative to this project. Please go through your PRs and close any that look like this.

Focus on the things that you and others will notice! That can be both developer or user experience. Like these are two good ones: #36570 & https://github.com/commaai/openpilot/pull/36647/files.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants