Skip to content

Conversation

eyebrowsoffire
Copy link
Contributor

By default, the browser fuzzes the timer APIs such that they have a granularity of approximately 100 microseconds (this is due to Spectre mitigation techniques). However, many of the thing we are trying to measure actually have a much finer granularity than 100 microseconds. As a result, many of our benchmarks are extremely noisy and don't provide accurate data.

By serving the initial script files with the Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp HTTP headers, the browser runs the benchmarks in a crossOriginIsolated context, which restores the fine granularity of APIs such as performance.now() to microsecond precision.

Also, we were considering anything an outlier that was more than one standard deviation away from the mean. In a normal distribution, that means we are only capturing 68% of the data and the rest are considered outliers. This is not ideal. Doing two standard deviations away captures 95% of the data, and the outliers are in the remaining 5%, which seems much more reasonable.

@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label May 31, 2023
@github-actions github-actions bot removed the c: contributor-productivity Team-specific productivity, code health, technical debt. label May 31, 2023
// Provide COOP/COEP headers so that the browser loads the page as
// crossOriginIsolated. This will make sure that we get high-resolution
// timers for our benchmark measurements.
if (mimeType == 'text/html' || mimeType == 'text/javascript') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also add this to flutter run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll have to address this question eventually, but I think we should really just do this for our benchmarks for now. Enabling crossOriginIsolated in flutter run could potentially break clients... we might want to do so conditionally or something. I think we should have a broader conversation about it, but it's probably out of scope of this PR. I'll have to figure this out for skwasm either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I filed #127902 as a follow on

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label May 31, 2023
@auto-submit auto-submit bot merged commit e8f4d80 into flutter:master May 31, 2023
@yjbanov
Copy link
Contributor

yjbanov commented May 31, 2023

To follow up, Skia Perf is picking up the change: https://flutter-flutter-perf.skia.org/t/?begin=1685500141&end=1685500143&subset=all

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2023
auto-submit bot pushed a commit that referenced this pull request Jun 8, 2023
This attempts to reland #126848

This was reverted because it made some unexpected changes to our perf measurements. After landing #127900, we have much less noise in our benchmarks, so I'd like to reland this and see if there is still a significant measurement difference.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants