Back to Field Notes

Kremio's performance round: what the emulator said, and what the phone said

We measured the Kremio app on an Android emulator with sales-sized data, then fixed what was slow: a first sync of 3,813 documents got about a third faster and a large form opened 40% faster. Then a phone contradicted the emulator's jank numbers, and we went with the phone.

Covers
Written
Repositories
kremio
Pull requests
2
Status
Shipped
Reading time
4 min
#kremio#testing#performance
Contents
JavaScript thread busy in a first sync
14.2 s → 5.1 s
requests in a sync with nothing new
61 → 11
opening a Sales Order with 15 rows
559 → 333 ms
janky frames with FlashList, on a phone
0.04%

Why we measured

Nikolas found two things slow on his phone: opening the app, and Aria’s message box, which stayed under the keyboard so he couldn’t see what he was typing. Before changing anything we measured. We used an API 35 Android emulator with 4 cores, release builds with timing marks that compile to nothing in normal builds, and a dev bench seeded with sales-sized data: 3,813 documents for a sales user to sync.

What was slow, and why

Before and after, on the emulator

MeasurementBeforeAfter
First sync of 3,813 documents (2 runs each)29.4 s, 37.8 s18.4 s, 27.1 s
JavaScript thread busy during that sync14.2 s5.1 s
Next sync with nothing new (median of 6)2.7 s0.9 s
Requests in a sync with nothing new6111
Opening a Sales Order with 15 rows (median of 12)559 ms333 ms
Cold start to the home screen (median of 20)1,360 ms1,238 ms
Typing 20 characters in Aria with 20 messages shown818 ms of renderingabout 100 ms
05001,0001,500msSales Order with 15 rowsCold start to homebefore, Sales Order with 15 rows: 559before, Cold start to home: 1,360after, Sales Order with 15 rows: 333after, Cold start to home: 1,238beforeafter
05001,0001,500msSales Order with 15 rowsCold start to homebefore, Sales Order with 15 rows: 559before, Cold start to home: 1,360after, Sales Order with 15 rows: 333after, Cold start to home: 1,238beforeafter
Opening a large form and starting the app, on the emulator (milliseconds) Opening a Sales Order with 15 rows went from 559 to 333 milliseconds. A cold start to the home screen went from 1,360 to 1,238 milliseconds, a change we called small and noisy.
Show data
beforeafter
Sales Order with 15 rows559333
Cold start to home1,3601,238

Memory at the peak of a first sync stayed at about 315 MB. We called the 9% on cold start small and noisy: most of a cold start is React Native’s and Expo’s own start-up, about 440 ms of it native constants, and the app’s own modules take 7 ms.

Then the phone

On Nikolas’s phone, over wireless debugging against our own site, a cold start to a usable home screen took about half a second with or without the fix: 522 and 512 ms in two rounds without it, 498 ms with it. One round with the fix timed out waiting for the home screen, so we have one clean number for it, not two. The keyboard fix showed up right away: Aria’s message box stayed above the keyboard. Afterwards the build he’d had before went back on the phone, byte for byte, with his sign-in and data kept.

FlashList, and the jank that wasn’t

Next we moved the document list from React Native’s FlatList to FlashList 2.0.2. Over 8 alternating rounds of 60 flings through 3,000 customers on the emulator, the JavaScript thread was busy 14.3 s instead of 27.0 s, while loading 1,100 rows instead of 660.

We didn’t ship on the emulator’s word, and we didn’t throw the change out on it either. A jank check on a real phone became a condition for the 0.4.0 release. On the phone, with the same list and 60 flings, three alternating rounds per build:

FlatListFlashList
Janky frames0.17–0.35%0.04%
99th-percentile frame12 ms10–11 ms

FlashList is smoother on a real phone. The emulator’s high jank readings were noise. The JavaScript-thread result, about half the work while loading more rows, held in all 16 emulator rounds.

Also found

A flaky list-screen test had failed 6 of 6 runs on main when the machine was busy. React Native loads ScrollView, Modal, FlatList and TextInput on first use, which took about 0.6 s in Jest, all inside the test’s first one-second wait. A longer wait alone still failed 2 of 6 runs. The test setup now loads those components up front, and waits 5 s.

All of it reached the 0.4.0 Android test build that evening.

What we’d tell someone else