-
Notifications
You must be signed in to change notification settings - Fork 28.9k
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
Conversation
…_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
This comment has been minimized.
This comment has been minimized.
for (int i = 0; i < 5; i++) { | ||
await SchedulerBinding.instance.endOfFrame; | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
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; | |
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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