Skip to content

[Android] Cold start ~0.6 s slower: the first-frame gate throttles the UI dispatcher to one item per vsync #25486

Closed

Description

@MartinZikmund

Current behavior 🐛

On Android, cold start is ~0.6 s slower on 7.0 than on 6.7 Skia: the first frame comes at 2,652 ms vs ~1,930 ms. Measured on a Pixel Tablet, Release, 7.0.0-dev.2275.

The extra time is all between the first page's InitializeComponent and Loaded.

  • It's not the render backend: Vulkan and OpenGL start within ~20 ms of each other.
  • It's not JIT: full AOT shows the same gap.

Root cause: until the first frame, the UI dispatcher runs about one queued item per vsync.

  1. ApplicationActivity arms a first-frame gate. NativeWindowWrapper.ActivationPreDrawListener.OnPreDraw returns false until a Skia frame has been presented.
  2. Each false makes ViewRootImpl cancel the draw and call scheduleTraversals() again, which posts a sync barrier every vsync.
  3. NativeDispatcher.Android posts through new Handler(Looper.MainLooper), so its messages are synchronous and wait behind that barrier.
  4. DispatchItems runs one queue item per message.

Startup is a chain of await continuations on the dispatcher's SynchronizationContext:

  • the font preload: 36 OpenSans faces plus the symbols font, each completing exactly 16.6 ms after the previous one, all on the UI thread;
  • then the page and Loaded.

So the first frame waits on work that is itself throttled by waiting for the first frame.

Expected behavior 🎯

Dispatcher work runs at full speed while the window's first draw is held back.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Create a blank unoapp targeting Android.
  2. Launch it twice; on the first launch the fonts aren't extracted yet, so it hides the issue.
  3. On the second and later cold launches, compare the time to the first CompositionTarget.Rendering after Loaded:
    • stock, against
    • a build where NativeDispatcher.Android uses Handler.CreateAsync(Looper.MainLooper).

Measured on a patched dev.2275 (6 interleaved cold starts each, ms after process start):

Loaded First frame
Stock 2,122 2,652 [2,643..2,677]
Async dispatcher handler 1,538 2,070 [2,051..2,087]

Runtime throughput (rapid element creation, LOLs, scripted scrolling) is unchanged within noise.

Workaround 🛠️

None from app code.

Affected platforms 📱💻🖥️

Android

Uno.Sdk version (and other relevant versions) 📦

7.0.0-dev.2275

IDE version 🧑‍💻

N/A

Anything else we need to know? 💬

The first-frame gate was added in July 2026, so 6.7 doesn't have the throttle.

Async messages bypass sync barriers; that's what Choreographer and input already use. Posting the dispatcher's messages that way keeps the gate and removes the throttle.

Activity

  1. added
    kind/bug
    platform/android 🤖
    area/performance 📈
    on Oct 14, 2026
  2. added a commit that references this issue on Oct 27, 2026
    6ac1900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/performance 📈kind/bugplatform/android 🤖

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions