Pick the fix
Tapping Save freezes the UI for two seconds. What is the first step?
Hint 1 of 1
Measure where it really runs.
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Profile a Release build on a device with Time Profiler and Hangs, and find the heaviest main-thread stack
Correct. It shows exactly what blocks the main thread.
Why not the others?
- B Move all code in the save path to Task.detached. That's guessing, and it can introduce data races.
- C Profile a Debug build in the simulator. The numbers won't match real devices.
- D Add print timestamps everywhere. It's slow to set up and misses system work.