Standalone desktop app (.exe) takes 15 - 30secs to start
11 次查看(过去 30 天)
显示 更早的评论
hello,
I wrote an app using MATLAB app designer, and packaged it to a standalone desktop app from Share -> Standalone desktop app selection in the Designer tab on top. During the packaging I selected to include the MCR in the installer.
Once installed on a new system and launched, the app can take anywhere from 15 to 30secs to start up. The app is not that large - about 25 to 30 UI components. Is there a way to speed up the launch? Also the splash screen appears briefly and then disappears with no feedback to the user that the app launch is still in effect.
Appreciate any help on this matter.
Thanks!
0 个评论
回答(1 个)
Hornett
2024-9-4
When you create a standalone desktop application with MATLAB App Designer and package it with the MATLAB Compiler Runtime (MCR), the startup time can be affected by several factors. Here are some strategies to help reduce the startup time and improve user feedback during the launch:
Strategies to Speed Up Launch
1. Optimize Code:
- Review your app’s initialization code. Ensure that any heavy computations or data loading are deferred until after the UI has been loaded.
- Minimize the use of loops and redundant calculations during the startup phase.
2. Lazy Loading:
- Load only essential data or components at startup, and defer loading additional data or components until they are needed (e.g., when a user interacts with a specific feature).
3. Reduce Dependencies:
- Ensure that your app only includes necessary toolboxes and functions. Unnecessary dependencies can increase the size and load time of the MCR.
4. Profile Your App:
- Use MATLAB’s built-in profiler (`profile on`) to identify bottlenecks in your code. Optimize or refactor sections of code that take a significant amount of time to execute.
5. Optimize Splash Screen:
- Ensure the splash screen remains visible until the app is fully loaded. You can achieve this by manually managing the splash screen display:
- Create a splash screen figure at the very beginning of your app startup.
- Keep the splash screen open until all initialization is complete.
- Close the splash screen once the main UI is ready to be displayed.
6. Use Smaller MCR:
- If possible, use a smaller version of the MCR by excluding unnecessary components. However, this requires careful analysis to ensure all required components are included.
Additional Considerations
- MATLAB Version:Ensure you are using the latest version of MATLAB, as performance improvements are made in newer releases.
- System Performance:The performance of the target system (CPU, RAM, disk speed) can significantly affect the startup time, especially if the MCR is being loaded for the first time.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!