The project I was working is to use react native to create an iOS app.
Following is the cold start time in iPhone 5S release build
Pre-main time: 0.52 seconds
App did launch to javascript did load time: 2.12 seconds
JS render time: 0.74 seconds
Total time: 3.34 seconds
The slowest part is to wait react library to load the js bundle (2.2MB). Is the loading time looks normal? How can I improve the js bundle loading time? Thanks so much.
Reducing the js bundle size can improve the time from Application did launch to javascript did load. For a new Hello World project, it only took 0.18-0.19 seconds (iPhone 5S).
Yes, the problem that you described really exist. As a possible solution you can use ram-bundle format, that metro bundler provides.
In this case you will not load the entire js-bundle - you will load only part, that you need at a startup (in a lot of application are a lot of places, which user may not even see, and this feature allow you load such parts, only when they are required). So you can simplify your entry point and load only small piece of your bundle.
You can look at react-native-bundle-splitter. This library well integrated with almost all popular navigation libraries and allows you to postpone a loading of specific routes. For example, if you have a login screen, you can load at start up only this screen, and all others load in background or start the loading of them, only when user can see them. And the startup time of your complex application will be almost equally as for "Hello world" application.
Whether the time ok is up to you and your app users only =)
Obviously, if reducing the js bundle size improves the time, you should do your best to get it done. There is several steps I guess can help you:
first of all, DRY: doubling code do increase the size
check for using npm packages, remove unused (also as unused inner modules)
obfuscate and minify the bundle with third-party tools
Also it should be done to reduce initializing complexity
check an asymptotic complexity of your algorithms - is can cause to time increasing
remove unused variables, functions and data - it can be a reason of redundant memory usage
And I can just advice you also try to affect not only an actual time but also a time feeling. For example, use an animated splash screen
Related
I've an electron app the start time of which is very slow - 20-30 seconds - when it runs for the first time after packaging. Subsequent times it's run the start time is 1, 2 seconds. Either; are there any thoughts on why this might happen or; are there any tools available that I might use to track the source of this.
macOS
Electron uses Chromium (Used By Google Chrome), maybe that's why when your application starts for the first time it takes time to make cache and other stuff, it also depends from Computer to Computer.
Some of the reason i've listed from the articles below.
Modules
for example you wanted to do some stuff but you are lazy and search for a module on which can do the work for you, i have no problem with that but sometimes modules have their own dependencies and those dependencies might have their own dependencies these dependencies can effect your start up time as "require" or "import" will load everything up which can cause your code be very big than it would've been if you wrote it yourself or downloaded a optimized small library to do same thing.
Using Synchronous Code
see i personally don't like the promise tree (the list of .then for handling asynchronous code) but if i use await or something it probably block my main process which can cause my application to freeze, that's why it's preferred to use promises.
Using Old APIs
In modern versions of chromium there might be better APIs for handling stuff which might be slow if you used old APIs.
Over all you don't need to worry if you're code will work on other browsers or not (until you're also making a web version of that too), because latest electron version will introduce latest APIs which will be shipped to your end users so don't worry if your code will work or not.
You Can Read These Articles Below Which may help you to increase your applications Performance:
How to make your Electron app faster - DEV.TO
Performance - ELECTRONJS.ORG
Why are desktop apps made with electron js framework slow? - QUORA
So, basically I'm trying to decrease loading times for an Action Extension I'm writing for IOS.
According to: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW7
I should aim to get the loading time below 1 second (if it takes too long it might be shut down by the system prematurely)
Right now it loads in around 4 seconds on an iPad (a bit faster in the simulator) - so far iOS haven't shut down my extension, but this will be destructive for the user experience.
As far as I'm aware I don't have access to a AppDelegate.swift file when working with extensions, thus I'm having a hard time figuring out what is causing the slow loading times.
Does anyone have any idea where to look or maybe some experience with this?
Thanks!
The reason for the slow loading times was that I launched the app extension in debug mode. Running the app without the debugger it was significantly faster.
Did not consider this at all, but now it works like a charm :)
The loading time of dynamic libraries has considerably increased causing a delay to the launch time of the app by several seconds. Though there are provision to load the libraries on need basis(lazy load), i would like to remove the most time-consuming library all together. which is the best approach to identify the load time of individual dynamic libraries.
I would look at DYLD_PRINT_STATISTICS as described here. See this post too.
I am analysing an app's slow performance using iOS Instruments. To load a login page it takes around 25 seconds. In Instruments, the timer shows 25 seconds to load the page. But when I sum the running times of the call tree, It is just around 4 seconds only. I want to know where the slowness is occuring. Is there anyway to force instruments to show all the time taken in call tree?
Note: I tried Xamarin profiler also. It shows maximum time taken by any call as 1E-06 ms. Is there any way to know the time taken by the whole method?
Have you considered using the Stopwatch class? It is supported in Project Core Libraries and can be used in a high-resolution mode for higher accuracy. It would allow you to time the execution of a particular method (which sounds like what you are attempting to accomplish). You can find Microsoft documentation and examples here.
I've been trying quite hard in the past 1.5 years to adopt a test-first process with my iOS development and basically found that two things prohibit me from doing this effectively:
compilation time — as project sources and test sources both grow (i.e. # source files grows), compilation time grows
wait for the iOS Simulator to launch — this can be slow as well.
As a result, even if your tests take milliseconds to run, it could take upwards of 5-10s to get feedback from them, simply because there's that magnitude of time spent preparing those tests to be run.
How can this be mitigated?