-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add FrameTiming delay to watchPerformance #64780
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
It allows (1) old FrameTimings to be flushed and not interfering our measurements here, and (2) new FrameTimings to be all reported. Fixes flutter#64778
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| final TimingsCallback watcher = frameTimings.addAll; | ||
| binding.addTimingsCallback(watcher); | ||
| await action(); | ||
| await delayForFrameTimings; |
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.
It looks like we only need one of L43 and L44?
And there's also a copy of watchPerformance in macrobenchmarks.
2s is not a very short time (vs ~10s sampling time), maybe we should also increase the timeout settings in macrobenchmarks.
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.
Good catch. I forgot to delete L44 during refactor.
| // Delay for a sufficient time so either old FrameTimings are flushed and not | ||
| // interfering our measurements here, or new FrameTimings are all reported. | ||
| final Future<void> delayForFrameTimings = | ||
| Future<void>.delayed(const Duration(seconds: 2)); |
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.
This sounds potentially flaky. Is there any way to improve coordination with the engine to avoid magic delays like this?
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.
Yes, it's flaky in terms of benchmark numbers (still have a chance to be bimodal and measuring the wrong thing), but not in terms of success/failure. It will be a net gain compared to our old version as the old ones have a higher chance of measuring the wrong thing.
We shall definitely have a more proper fix to solve this reliably. Created #64808 to track that.
| final TimingsCallback watcher = frameTimings.addAll; | ||
| binding.addTimingsCallback(watcher); | ||
| await action(); | ||
| await delayForFrameTimings; // make sure all FrameTimings are reported |
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.
If the intention here is to wait for another 2 seconds, then I think you will need a fresh instance of Future.
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.
Good catch. Fixed.
It allows (1) old FrameTimings to be flushed and not interfering our
measurements here, and (2) new FrameTimings to be all reported.
Fixes #64778