这是indexloc提供的服务,不要输入任何密码
Skip to content

Wait for frame rendering to stabilize before running the all_elements_bench benchmark #81086

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

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

jason-simmons
Copy link
Member

Without this, rendering of the initial frames will occur after the
benchmark measurement completes. This may result in shader compilation
happening while the benchmark app is shutting down, which can cause
crashes.

See #77193

…_bench benchmark

Without this, rendering of the initial frames will occur after the
benchmark measurement completes.  This may result in shader compilation
happening while the benchmark app is shutting down, which can cause
crashes.

See flutter#77193
@jason-simmons jason-simmons requested a review from dnfield April 23, 2021 21:58
@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Apr 23, 2021
@flutter-dashboard

This comment has been minimized.

@google-cla google-cla bot added the cla: yes label Apr 23, 2021
Comment on lines +46 to +48
for (int i = 0; i < 5; i++) {
await SchedulerBinding.instance.endOfFrame;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we guaranteed to get five frames?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In test runs this appears to work. I'm not sure what would be safest here given that AFAIK there isn't a signal from the framework indicating when enough frames have rendered.

This comment was marked as spam.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

Suggested change
for (int i = 0; i < 5; i++) {
await SchedulerBinding.instance.endOfFrame;
}
assert(SchedulerBinding.instance.hasScheduledFrame);
for (int i = 0; i < 5 && SchedulerBinding.instance.hasScheduledFrame; i++) {
await SchedulerBinding.instance.endOfFrame;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SchedulerBinding.instance.hasScheduledFrame is false at this point in the script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh actually, looking at endOfFrame's impl, it looks like it schedules a frame if one isn't already pending. Ok. This should be fine.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants