Order File Integration


Every build using an order file should provide the order_file_version flag when uploading to Emerge. Emerge will generate a new order file for each of these uploads. Download the latest order file at build time by using the Fastlane plugin. The first time you build with a new order_file_version you won't be able to download a file from Emerge because we haven't generated one yet, you can not use the order file linker flags for that first build.

emerge_order_file(app_id: 'com.emerge.app', order_file_version: '1.0', output_path: '/tmp/orderFile')

The order_file_version number stores versions of the order file corresponding to a particular version of your app.

After the order file is downloaded, build using these linker flags:

-Wl,-order_file,/tmp/orderFile, -Wl,-order_file_statistics

Finally, upload the resulting build with the Emerge fastlane plugin, setting the order_file_version to the same value as the version you requested in the first step. This app will be installed and launched to generate a new order file. Refer to App Installation for more details on this process.


There are two numbers that should be logged to understand how order files affect app launch: total app launch and pre-main time.


Metric measurements note

All metrics should be collected at percentiles, such as p50, p75, p95, as well as the mean. The OS may cache pages of app memory between launches making order files more applicable to higher percentiles, but this depends on your app's usages patterns.

Total app launch

The most important metric is the total app launch. Measured from process start to the point in your code where the app launch notification is posted.

Pre-main time

The second metric is pre-main time (optional). Measure this as time from process start to when the main function is called. Depending on the structure of your codebase, this time may or may not be affected by order files. Having this metric can help debug any issues that come up during validation testing.


Step 1: Validation in release

Measuring order files in production is difficult for typical mobile release schedules because changes caused by the order file can't be separated from changes introduced by all other changes since the last release. This is why we recommend starting with alpha build measurements.

To see the effect of adding an order file, only build internal alphas with an order file every other day. If the order file is improving your app launch, this alternating pattern should be noticeable when comparing app launch times of alpha builds to the previous day.

Step 2: Custom App Store release

To measure the true effect in production order files need to be isolated from other changes. To do this, wait until you have sufficient data to measure app launch after a normally scheduled release, and then release a new build with only order files added.

The startup time difference between the two releases can then be compared to see how much of an impact order files have on your app launch.