IssueRaiser

Flutter adds additional one frame touch latency compared to native

| Bad | Expected | | ------------- |:-------------:| | <video src="https://user-images.githubusercontent.com/96958/187072879-717668ac-a4fe-4e43-adc4-60d3774e5e1a.mov"> | <video src="https://user-images.githubusercontent.com/96958/187072886-6cbe0e23-78d5-4086-ad5f-756832ea4bb3.mov"> | Repository: https://github.com/knopp/flutter_scroll_overlay When touch event is received, instead of immediately beginning a frame Flutter waits for next vsync. But that skips an entire frame. By the time vsync comes, the frame should be already rendered and ready to go. But instead it has just began. On iOS touch events seem to be delivered within few milliseconds of the display link callback so there should be enough time. You can pause the "bad" video to see that during scrolling Flutter lags behind native by one frame exactly. The expected video is with quick and dirty engine modification that forces BeginFrame immediately on input event. The way vsync is implemented in Flutter might need some work. It should make sure that repaints are synchronized with display updates, but it shouldn't be causing additional latency.

Posted by knopp on Aug 28, 2022, 12:11 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (Network)

Flutter adds additional one frame touch latency compared to native

knoppAug 28, 2022, 12:11 PM

| Bad | Expected | | ------------- |:-------------:| | <video src="https://user-images.githubusercontent.com/96958/187072879-717668ac-a4fe-4e43-adc4-60d3774e5e1a.mov"> | <video src="https://user-images.githubusercontent.com/96958/187072886-6cbe0e23-78d5-4086-ad5f-756832ea4bb3.mov"> | Repository: https://github.com/knopp/flutter_scroll_overlay When touch event is received, instead of immediately beginning a frame Flutter waits for next vsync. But that skips an entire frame. By the time vsync comes, the frame should be already rendered and ready to go. But instead it has just began. On iOS touch events seem to be delivered within few milliseconds of the display link callback so there should be enough time. You can pause the "bad" video to see that during scrolling Flutter lags behind native by one frame exactly. The expected video is with quick and dirty engine modification that forces BeginFrame immediately on input event. The way vsync is implemented in Flutter might need some work. It should make sure that repaints are synchronized with display updates, but it shouldn't be causing additional latency.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue