TL;DR
Lazy Loading and Deferred Initialization
One of the most effective strategies to improve app load time is to defer the initialization of non-critical components until they are actually needed. This can be achieved through lazy loading of data or components [1:1]
[4]. For example, instead of initializing all BLOCs at startup, you can load them only when required
[1:3]. Similarly, moving heavy SDK initializations to a background thread using tools like WorkManager or Dispatchers.Default can significantly reduce startup time
[4:4].
Background Tasks and Thread Management
Managing background tasks efficiently is crucial for reducing app load times. Using Future.wait
to make simultaneous API calls can help speed up data fetching processes [1:6]. Additionally, ensuring that tasks such as syncing mechanisms run on background threads rather than the main UI thread can prevent stuttering and freezing issues
[2:1].
Caching and Session Management
Utilizing cached data instead of fetching new data every time the app starts can enhance performance [1:3]. Implementing robust session management can also minimize unnecessary server checks during startup, which can further streamline the process
[1:1]. For apps with large libraries or data sets, enabling options like remote image preference can improve performance by reducing local processing demands
[2:3].
Profiling and Optimization Tools
Regular profiling of your app using tools like Android Studio Profiler can help identify bottlenecks in the startup process [4]. Profiling allows developers to pinpoint specific areas where optimization is needed, such as heavy operations running on the main thread
[5]. Additionally, shrinking APK size and optimizing layouts can contribute to faster install and rendering speeds
[5].
Network and Resource Management
Avoid blocking the main thread with network calls or resource-heavy operations [5]. Instead, handle these tasks asynchronously using coroutines or background contexts. Efficiently managing images by resizing bitmaps and using libraries like Glide or Picasso can save memory and smooth out the UI
[5]. Flattening layouts by reducing nesting and using ConstraintLayout can also improve rendering speed
[5].
Hi everyone,
I'm working on a Flutter app that takes a bit too long to launch and navigate to the home screen. I would really appreciate some advice on how to improve performance, especially during startup.
main()
function.Despite optimizing some steps, there is still a noticeable delay between launching the app and displaying the home screen. I tried deferring some API calls, but it didn't make much difference.
What are some best practices to reduce loading time during the initialization of a Flutter app, especially when using blocs/cubits and backend services like Firebase? Any tips on improving smoothness during redirection and managing navigation after launch?
Thanks in advance for your suggestions!
How long does it take? And is it also slow in prod? The app I work on is quite large and does lots of stuff on launch. from pressing the icon until its ready for use is 1-3 seconds, sometimes slower if its an old device. I’ve never had bad feedback because of launch time
Similar. My app has 7 steps at startup (very similar to what OP is describing, with Firebase init, Version check, Feature toggle service checks, initializing a few hard dependencies) and it takes less than 300-500ms on most devices (we track it with Firebase Performance).
The app typically takes around 3-4 seconds to launch in production. While this is generally acceptable and we haven't received negative feedback regarding the launch time, I believe there's room for improvement. I'm actively looking into ways to optimize the startup process to make it even faster.
If you’re making lots of api calls in a row, wrap them in a future.wait to make the calls simultaneously. If you’re fetching data that isn’t required straight away then fetch it after the app is running
The simplest "quick wins" i can suggest are:
You can probably do some more advaned stuff like background fetches or moving some of your requests or initial setup to isolates where (and if) that makes sense for your use case.
The general rules of thumb here are:
That being said, a few notes to keep in mind are:
Hope it helps!
I've looked into your suggestions and they make a lot of sense. Here's what I plan to do:
Also, I realized that some of the loading delay might be due to the debug mode itself, as it doesn't fully represent the production environment. I'll run performance profiling in production mode to get a better picture.
Thanks again for the great advice!
If you are awaiting for multiple things in startup, make sure you are using Future.wait instead of serially awaiting one at a time.
It's hard to say what's wrong without seeing the code, but everything that loads at the beginning needs to be loaded at that time?
Hi
Are there any optimization guides or performance help with the immich app for iOS and android? I have a iphone 15 and a galaxy s23 and in the app there is constant stuttering and freezing. On android it often pops up that the app is unresponsive and asks me if I want to wait or kill the app.
If I access the library web interface from a different computer than the one hosing immich the performance is perfect without issue, its only the apps.
- I am running the docker image of immich on my m1 mac mini.
- I have a library of approximately 74000 photos and videos.
The phones are connected with wifi to the same network as the mac mini.
I have tried turning on the "prefer remote images" setting but it seems not to make a difference.
Same here. App is written in flutter. I write some apps in this framwework and I know people who write flutter apps for living. These applications will not have the same performance as those written natively. And it’s really hard to make it perform smoothly. Even simple apps struggle with it. I believe it’s easier for Immich team to write one code for all three platforms (iOS, android, web), but unfortunately it is at the cost of performance.
The problem is with the sync mechanism running on the UI thread, we are working on moving them to the background and it’s pretty promising so far
I totally agree, I made apps in flutter and even simple apps felt sluggish on iOS. When I made the same app in native it was 10 times faster.
I run the iOS app and like many was having performance issues. No one mentioned to try enabling the option to prefer remote images under advanced setting.
Simply enabling that option resolved the iOS performance issues for me. It’s now super fast no issues
Great! What’s its cons?
Personally I have not found any cons. If I think of 1 perhaps it would be that you would use more internet data when outside of home accessing photos.
I have a powerful server running Immich so that also contributes possibly to no cons found to this setup.
Gigabit internet for external connection
Striped 2x SSDs for storage of photos
i5 8400 CPU running docker container
It works slow while app is creating timeline. Once it's finished it'w working good. I think devs said that it's being worked on, that they are moving timeline building and other similar workload out of main thread so once it's done it should work good no matter how large pic library is.
Give a try also to logout/login back, that greatly improved the issue for me.
The issue is with the sync mechanism happens on the main thread, causing the UI to be janky. We are reworking this mechanism, the progress is very promising in making the app really smooth regardless of library size
Amazing, thanks! When can we see it roll out?
Hopefully within the next two months
The iOS app is amazing, so thanks to the developers for all the hard work.
I’m wondering if there’s a way to reduce load times by background syncing the dashboards or using web sockets to only refresh changes without having to load the whole dashboard?
It takes about 3 seconds to load, which isn’t a major issue, just really annoying when you want to do something fast like turn on a light.
Edit: the delay is a home assistant splash screen with a loading icon saying “loading data”. I’m using Nabu Casa too, but testing this while on wifi on my local network. Loading home assistant on my web browser is instant.
How long does it take to load in a browser on your phone? I have found you don't want to have history graphs on your main page if load time is important.
It loads instantly on a web browser on the same device.
My app opens the dashboard within one second after I force close it. I don’t have any history graphs on first page but lots of conditionals
Are you on wifi or 4g?
When I’m on wifi it’s super fast, but when I switch to 4g it takes a couple of seconds.
Are you using nabu casa? I like it, but I did find it a bit slower than a direct connection - likely as it needs to go through some servers far away from me which adds some latency.
I’m on wifi. I use Nabu Casa, but I thought that when you’re on the local network it bypasses that and goes straight to the local server?
The delay is a home assistant splash screen with a loading icon and the text “loading data”.
Yep, locally it bypasses nabu casa. My first screen is mostly buttons , no graphs or other. Maybe that’s why it loads faster? Maybe create an additional first page in Lovelace with the key buttons you need so that you have quick access?
I think I found the issue. It didn’t have local URL in the app config. Strange, because before the Nabu Casa setup used to automatically handle this. It’s much faster now! Thanks everyone.
It takes me less than a second and my dashboard is a mess.
I recently ran into a startup lag issue in one of my native Android apps (written in Kotlin). After profiling with Android Studio Profiler, I realized initializing some heavy SDKs inside Application.onCreate() was the culprit.
Here’s what I did:
Moved non-critical SDK initializations to a background thread using WorkManager.
Deferred some lazy object creations until actually needed.
This makes startup time dropped from 1200ms to 800ms on a mid-range device.
Tips
Android profiler kept crashing my app. Unsure why that was though.
yeah profiler can be super unstable sometimes… i noticed it struggles a lot with big apps or when you have too many background threads spawning at once on cold start. you on a physical device or emulator when it happened?
Why would you use WorkManager to initialize something in a background thread?
yeah fair question… in my case a couple of SDKs needed to do stuff even if the app gets killed n reopened later… like crash reporting or analytics uploads… so WorkManager made sense for those… for regular inits yeah Dispatchers.Default would totally work
You can also use app startup API for SDK initialization https://developer.android.com/topic/libraries/app-startup
I am using them heavily in my new project, although it is still incomplete, you can check it out here, I am currently moving the XML code to Compose as I recently learned it.
Using Hilt + Compose + StartUp libraries in this one.
yeah true… App Startup API’s neat for stuff like this too… have u tried comparing it with WorkManager for cold start cases? curious if there’s any noticeable diff 👀
Why did you need WorkManager ? Why not a simple background context like Dispatchers.Default or IO ?
yeah for one-time inits during startup Dispatchers.Default works fine… in my case some of em needed to persist or retry if the app restarted so WorkManager felt safer… but def depends on the usecase
I think WorkManager is way less consistent. It can delay running something for a long time. It just adds way more layers and difficulty to actually running something.
It's hard for me to imagine a scenario where WorkManager is correct to use. It would have to take many seconds to initialize to even begin thinking about that being the correct option.
Dont forget about the null pointer crashes
haha yep… no matter how modern the SDK gets, null’s always lurking in the shadows 👻
Android devs performance tips that saved my apps (and sanity):
inJustDecodeBounds
) and use Glide/Picasso/Fresco. Saves memory, smooths UI.These lessons came from painful debugging sessions. Got any favorite performance tricks or tools? Let’s swap ideas!
Flatten layouts sure. However, CL is not a silver bullet. It can be pretty expensive comparatively.
network calls, JSON parsing in Work Manager?
My app do heavy JSON reading on multi-threads, at startup it lags on slow phones, I read latest Flutter release have improved the engine performance, will that improve my app performance?
the app startup time 3 seconds on decent phones but on slow phones can take 5-6
Sounds more like a caching problem than a UI problem.
Need to try cache OR preload the bare minimum data to start the app.
then once that's done, Need to use all the tricks in the book to make the app look quick even when it's working on something.
Also you don't say what version you are on now? If it's a relatively old one then you will pickup some perf improvements, but I think engine performance isnt the problem here.
I work on Flutter 3.24, I do cache to be able to run isolates without rootBundle
For your use case: probably not.
You may improve this a lot by replacing json with a prefilled sqlite database or maybe protobuf.
Will try but does SQLite result in bigger file size? The total json files 200mb but with apk compression become 15mb, does that happen same for sqlite?
If 200 MB can be compressed by factor 13 to 15 MB, your JSON doesn't contain much information (according to information theory). You might want to preprocess the data before adding it to your application.
Some kind of custom binary encoding might be faster to parse. However, keep in mind that Dart uses a highly optimized JSON parser as part of the runtime which might process data faster than your own code written in Dart, especially if you're not careful with allocations.
Still, if you parse JSON into some kind of class instances (instead of using the raw Map, List and String values) I'd attempt to directly deserialize your data into those instances.
Or even better, don't load the data at all. Do you need every byte of that JSON file in memory all the time? Using an sqlite3 file might allow index-sequential access. However, that index will need additional space, so the file might not compress as well as your JSON.
Again, a custom file format might come handy. If your JSON is basically a set of data records, you might want to read in an index that tells you where to seek in a RandomAcessFile object for the single record you need. Switch from JSON to JSONL, then you can still read an individual object like before.
Good question. No idea. sqlite file will be likely smaller but may not compress as well.
200 mb json is no joke
Compression happens. The db by default will store it far more efficiently, then it will compress.
Random people on the internet won't help you with vaguely formulated performance questions. Run your app (or if you have too many shady dependencies that doesn't work anymore with the current version of Flutter create a demo) and measure the performance.
For a json.decode
call, you don't even need a Flutter app. A simple AOT compiled Dart program is sufficient.
Hopefully you already measured that this call is the culprit and not some other part of your application.
Flutter engine is going to mean UI performance, JSON parsing is a Dart thing.
I've not seen much speed improvements by updating to the latest. I did however have to deal with a gradle update that lost me 2+ hours of my time
I have many Nest devices and it takes about 10-15 seconds to load the app on my iPhone.
Does anyone have suggestions for how to speed this up?
Thank you.
It loads in 5 to 7 seconds for me on an iPhone Xs Max and the same on a Pixel 2 XL on WiFi.
6 to 8 seconds on both phones on LTE.
I only have a few devices though and have Spaces set to off.
I have an iPhone 11 and it takes 3-5 seconds to load until I see a camera feed. I do not have nest secure. Do the people experiencing longer load times have nest secure?
I have my doubts it will improve. I’m under the impression they are rolling all of the nest app features into the google home app so I wouldn’t be surprised that is where their effort is going.
Use an android phone instead ��....sorry......couldn't help myself
Yes...but aside from that option...any other suggestions?
Just tested my app load time (iPhone 11 Pro) and yeah it’s about 12 seconds. We even have pretty fast WiFi (250Mbps). Not sure if there’s much else we can do : (
I love FFRK, but the load screens are so much more obtrusive than other mobile games I've played lately, and it's really frustrating how often and how slowly navigating the game can be. I currently have a Samsung Galaxy S8, which I set to "Game mode" to improve performance. Is there anything I can change in my settings? I've seem Game Booster apps before as well, are there any good ones? I'm always worried that they might not do anything but spam me with ads.
Don't play as often
Less game time = less load time
#shittylifehacks
Thanks for the tips. I'll see if I can trim down my storage, or go back to emulating. I prefer using my phone, but I guess I'll just have to cope.
It's the game itself. Not much can be done. Not even emulator or a different phone will resolve it in any meaningful way (I play on my phone, a Sony Xperia XA1 Ultra, and Nox Emulator, no real difference).
It is what it is, just have to accept it.
Make sure you’re not close to the limit on phone storage. Constantly download your photos and clear em out as well as all the duplicate photos in texts to people.
As an iPhone user, I’m sorry. People say load time is better on iPhones, but I don’t have an android anymore to test. Well, I have Nox, but that loads just as fast if not faster than my iPhone 7.
I’d be curious to see some side by side video of it... not that it would really solve anything.
Hello !
I'm new here, but I wanted to share with you this article that I wrote regarding performance optimizations for initial load times for angular applications. It might not be for everybody, but I wanted to share with you some of the steps I took in order to improve the TTI for an enterprise angular application.
Let me know what you think and if you like it, hit that Clap button and follow me because I am planning to write more and more.
If your application is considerably large with multiple complex components in the first screen, you can try to lazy load such components with custom loading logic. You can prioritize critical components and then move on to rest. But fair warning this will make the application complicated.
I’m about to launch my first ever app and for the first time on the App Store but there are some optimisations I want to make after. Should I be worried about launching it prematurely or will I be fine after? I’ve seen people say there’s a boost when you first launch your app but I’m not sure how true that is
Launching your app prematurely can be a double edged sword…..yes the App Store gives new releases a short term boost, which can help you gain initial downloads and user feedback. However, this advantage will fade quickly if your app lacks polish
Just ship the MVP. Don’t rely on new app ‘boost’, many people in the space agree this doesn’t happen on the App Store after algorithm changes, and I have never noticed it at all on Android. Your app will have bugs. Test it daily from as many devices as possible. Get feedback, tune keywords, rinse and repeat. Add/remove features based on feedback and testing. The days of building a perfect app and then shipping with fanfare are long over. Ship fast and test in production, or fall behind
Regarding the first-release boost, I can confirm that it’s no longer there. I have several apps in a App Store that are fairly similar in functionality (digital versions of old encyclopedia), and there was no noticeable boost in the last app I released (around May 2025).
Yep and apps get rejected even more often for any little thing, Apple’s way of cutting down AI slop in their store. Meanwhile, Android is still so easy and painless; except the unfortunate play console ui update
It's true most of the time apps get initial boost and yeah to maintain that boost you have to meet the required KPIs.
In my experience, the first release must be bug-free and have all the core functionality, UI/UX etc. in place. Bells and whistles can come later. There is a short term (1-2 weeks) boost initially, but if you launch it half-baked and get a few low ratings/reviews, your downloads and visibility will suffer despite subsequent polishing / bug-fixing.
Thank you for this - I’ll test my app thoroughly to make sure there are no bugs remaining!!
Just make sure you maintain user data transparency and adhere by content safety policy to not get rejected.
Keep options like report a profile if somethings fishy, or let the users know why you are accessing there gallery as clear as possible.
Ahh thank you for this reminder!! I need to also update my terms of use
How to improve app load time
Key Considerations for Improving App Load Time
Optimize Images and Assets:
Minimize HTTP Requests:
Implement Caching:
Reduce Server Response Time:
Optimize Code:
Use Asynchronous Loading:
Monitor Performance:
Recommendation: Start by analyzing your app's current performance using a tool like Google PageSpeed Insights. This will help you identify specific areas for improvement. Focus on optimizing images and minimizing HTTP requests as these are often the most impactful changes you can make. Implementing caching strategies can also yield significant improvements in load times.
Get more comprehensive results summarized by our most cutting edge AI model. Plus deep Youtube search.