Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize the separated frame mechanisms #12

Open
1 task
Nayuta403 opened this issue Apr 3, 2022 · 6 comments
Open
1 task

optimize the separated frame mechanisms #12

Nayuta403 opened this issue Apr 3, 2022 · 6 comments

Comments

@Nayuta403
Copy link
Member

Nayuta403 commented Apr 3, 2022

@youchant
Copy link

这个 issue 现在是什么进度呢?

@Nayuta403
Copy link
Member Author

还没进度,现在的情况是说每次任务只渲染一个 widget,但其实可能它不怎么耗时。希望做到说,如果这个任务不怎么耗时,那么是不是可以再执行一个任务。

但这个依赖于,要得到每一个任务的执行时间,现在的每一个任务是 setState,这玩意儿在当前帧只是一个标记操作,下一帧执行耗时,所以没法拿到这一帧的时间。

我能想到的是,能不能先去把这个任务机制改下,不做 setState, 看下有没有办法直接在这一帧渲染 widget。一来可以统计时间(但这个时间只是 framework 的,可能没那么准),二来可以提升整个页面的渲染速度(理论上页面完成渲染的时间会快两倍)。

@Nayuta403
Copy link
Member Author

Not yet. At this point we're only rendering one widget per task, but it's probably not that time-consuming. Hopefully, if this task is not too time-consuming, can you execute another task?

But this depends on, you know, getting the execution time of each task, now each task is setState, this thing is markNeedsBuild operation in the current frame, the next frame takes time to execute, so you can't get the time for that frame.

The only thing I can think of is if I can change the task mechanism without setState and see if there is a way to render the widget directly in this frame. First, it can count the time (but this time is only framework, may not be so accurate), and second, it can improve the rendering speed of the whole page (theoretically, the page will finish rendering time twice faster).

@fzyzcjy
Copy link

fzyzcjy commented Sep 17, 2022

I seem to come up with a solution here: flutter/flutter#101227 (comment)

@inc16sec
Copy link

I seem to come up with a solution here: flutter/flutter#101227 (comment)

Will there be a pull request any time soon? to test the solution.

@fzyzcjy
Copy link

fzyzcjy commented Sep 19, 2022

@inc16sec It is in https://github.com/fzyzcjy/flutter_smooth, but still WIP!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants