-
Notifications
You must be signed in to change notification settings - Fork 10.4k
ui: only import layouts that are used #36648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui: only import layouts that are used #36648
Conversation
There was a problem hiding this 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
MainLayoutandMiciMainLayout - Added conditional imports inside
main()based ongui_app.big_ui()check
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Will update to do this for setup, updater, reset layout imports also |
|
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. |
|
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. |



























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