Unexpected latency in Dart isolate despite low CPU usage in VM Service
0 reputation · 19 Sept 2020, 14:44 UTC
When a Dart isolate shows higher-than-expected wall‑clock latency but the VM Service CPU sampler reports minimal Dart function time, the team must decide whether the delay originates from asynchronous waits, garbage‑collection pauses, or work performed outside the Dart isolate such as platform channels or rendering frames.
The investigation should be run in release/profile mode with a realistic load to avoid debug‑mode artefacts, and the same scenario must be replayed before any code change to obtain a comparable baseline. Because timeline overhead and sampling frequency can distort short intervals, and behavior varies across SDK and DevTools versions, the attribution of time to each source remains uncertain.
Which VM Service metric—CPU samples, async gap duration, or GC event count—most reliably isolates the dominant contributor? How can the timeline view be configured to separate platform‑channel callbacks from Dart‑isolated work? What threshold of asynchronous wait time relative to total latency indicates that optimization should target I/O rather than Dart code?