How to measure startup time of app

Hi,

I’m trying to find a way that we can measure / monitor the startup time of the app from when it is launched. However, by default we can only measure the time from when the javascript is ready and parsed. Is there (or could there possibly be?) a start time exposed through expo from native that we can hook into?

Many thanks

I think it should be possible for the Java/Objective C code to save the start time as one of the first things it does and make it available to the JS code.

Maybe you could create a feature request. Of course if you are able to figure out how to do it in the Expo code maybe the Expo team would be willing to incorporate your change, which I suppose would probably be the fastest way to get this implemented.

1 Like

@wodin There’s this library that does it - but I don’t know how to link it. Do you know if auto-linking might be coming to expo? https://github.com/doomsower/react-native-startup-time

Hi

I am not quite sure how autolinking fits in, but I don’t think it’s relevant to the Managed Worflow. The Expo team is apparently working on things like customising builds, which I think would help with things like this, but I don’t know how far away that is.

In the mean time, if you haven’t yet voted on this feature request which I’ve just found again and realised is what you’re looking for, I suggest you do so.

Yep thanks, I’ve voted and commented on that one and included a link to the relevant library. Hope it gets picked up by one of the team. I’ve got a potential performance improvements for our app startup (based on https://v8.dev/blog/cost-of-javascript-2019#json), and it would be great to be able to measure the full startup time before/after to verify that if it had a positive effect.

I suppose you might be able to do something like this:

  • Make sure everything’s committed to Git
  • Checkout a version of the app from before the change you’re trying to measure
  • Eject
  • Install react-native-startup-time (or whatever), build the app on your machine and record the startup time
  • Get rid of the ios/android directories etc. that were created by ejecting (e.g. git clean -xdf, but that will get rid of node_modules too, so might be overkill)
  • Checkout the version of the app from after the change you’re trying to measure
  • Eject
  • Install react-native-startup-time, build, record the startup time
  • rm -r ios android (or whatever)
  • Compare the times from before and after the change