diff --git a/testing/perfdocs/generated/raptor.rst b/testing/perfdocs/generated/raptor.rst index 1a90cc565f89..c13a15456b68 100644 --- a/testing/perfdocs/generated/raptor.rst +++ b/testing/perfdocs/generated/raptor.rst @@ -5131,7 +5131,7 @@ Standard benchmarks are third-party tests (i.e. Speedometer) that we have integr ./mach raptor -t stylebench - **Owner**: :emelio and Layout Team + **Owner**: :emilio and Layout Team * **alert threshold**: 2.0 * **apps**: firefox, chrome, safari diff --git a/testing/perfdocs/generated/talos.rst b/testing/perfdocs/generated/talos.rst index 122b9d4f086f..28d31ac1139d 100644 --- a/testing/perfdocs/generated/talos.rst +++ b/testing/perfdocs/generated/talos.rst @@ -5459,7 +5459,7 @@ For the sample commands found below, note that the capitalization used is import ./mach talos-test -a perf_reftest_singletons - * contact: :emelio and Layout team + * contact: :emilio and Layout team * source: `perf-reftest-singletons `__ * type: `Page load`_ * reporting: intervals in ms (lower is better) diff --git a/testing/raptor/raptor/tests/benchmarks/stylebench.toml b/testing/raptor/raptor/tests/benchmarks/stylebench.toml index b1c4b0e32e64..dbd5656a1d59 100644 --- a/testing/raptor/raptor/tests/benchmarks/stylebench.toml +++ b/testing/raptor/raptor/tests/benchmarks/stylebench.toml @@ -4,7 +4,7 @@ apps = "firefox, chrome, safari" gecko_profile_interval = 1 expose_browser_profiler = true lower_is_better = false -owner = ":emelio and Layout Team" +owner = ":emilio and Layout Team" page_cycles = 5 page_timeout = 140000 subtest_lower_is_better = true diff --git a/testing/talos/perfdocs/config.yml b/testing/talos/perfdocs/config.yml index b00feb884e71..f5dc8ca750e4 100644 --- a/testing/talos/perfdocs/config.yml +++ b/testing/talos/perfdocs/config.yml @@ -662,7 +662,7 @@ suites: 167.36, 167.265, 167.75500000000002, 166.895, 167.735, 166.985, 166.275, 166.54000000000002, 165.61, 166.115, 166.64499999999998, 165.68, 167.64499999999998, 167.12, 168.15, 166.575, 166.335], perf_reftest_singletons: > - - contact: :emelio and Layout team + - contact: :emilio and Layout team - source: `perf-reftest-singletons `__ - type: `Page load`_ - reporting: intervals in ms (lower is better) diff --git a/third_party/webkit/PerformanceTests/StyleBench/README_MOZILLA b/third_party/webkit/PerformanceTests/StyleBench/README_MOZILLA index 02677c422373..a88ba732a6c4 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/README_MOZILLA +++ b/third_party/webkit/PerformanceTests/StyleBench/README_MOZILLA @@ -1,8 +1,8 @@ The source from this directory was copied from the PerformanceTests/StyleBench directory of the Webkit repository -at: https://svn.webkit.org/repository/webkit/trunk +at: https://github.com/WebKit/WebKit/ -The SVN revision used was: 234578 +The git commit used was: aac8c557da9ae65151ba533ba8d5b1c7841e741c The contents of this directory are intended for use to "train" the profile guided optimization (PGO) of Firefox and for benchmarking diff --git a/third_party/webkit/PerformanceTests/StyleBench/index.html b/third_party/webkit/PerformanceTests/StyleBench/index.html index 83dc2345a1f9..85fa1cf14f11 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/index.html +++ b/third_party/webkit/PerformanceTests/StyleBench/index.html @@ -2,7 +2,7 @@ - StyleBench 0.3 + StyleBench 0.4 @@ -20,7 +20,7 @@ StyleBench is a browser benchmark that measures the performance of the style resolution mechanism.

- Your browser window is too small. For most accurate results, please make the viewport size at least 850px by 650px.
+ Your browser window is too small. For most accurate results, please make the view port size at least 850px by 650px.
It's currently .

diff --git a/third_party/webkit/PerformanceTests/StyleBench/mozilla.patch b/third_party/webkit/PerformanceTests/StyleBench/mozilla.patch index 2c3988f2ff8b..acc1186d2b4e 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/mozilla.patch +++ b/third_party/webkit/PerformanceTests/StyleBench/mozilla.patch @@ -65,6 +65,7 @@ index b33021d9d9ce..58b3e46982d1 100644 + if (location.search == '?raptor') { + var data = ['raptor-benchmark', 'speedometer', measuredValuesByFullName]; + window.postMessage(data, '*'); ++ window.sessionStorage.setItem('benchmark_results', JSON.stringify(data)); + } else if (typeof tpRecordTime !== "undefined") { + var values = new Array; + var allNames = new Array; diff --git a/third_party/webkit/PerformanceTests/StyleBench/resources/benchmark-runner.js b/third_party/webkit/PerformanceTests/StyleBench/resources/benchmark-runner.js index a248182594d7..a1d14d41011f 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/resources/benchmark-runner.js +++ b/third_party/webkit/PerformanceTests/StyleBench/resources/benchmark-runner.js @@ -126,23 +126,23 @@ BenchmarkRunner.prototype._runTest = function(suite, test, prepareReturnValue, c var contentWindow = self._frame.contentWindow; var contentDocument = self._frame.contentDocument; + // Force style resolution before running the test to ensure we don't measure stuff unrelated to the test. + window._unusedHeightValue = contentDocument.body.getBoundingClientRect().height; self._writeMark(suite.name + '.' + test.name + '-start'); + var startTime = now(); test.run(prepareReturnValue, contentWindow, contentDocument); + // Force style resolution + layout to ensure we're measuring it. + window._unusedHeightValue = contentDocument.body.getBoundingClientRect().height; var endTime = now(); + self._writeMark(suite.name + '.' + test.name + '-sync-end'); var syncTime = endTime - startTime; - - var startTime = now(); setTimeout(function () { - // Some browsers don't immediately update the layout for paint. - // Force the layout here to ensure we're measuring the layout time. - var height = self._frame.contentDocument.body.getBoundingClientRect().height; - var endTime = now(); - self._frame.contentWindow._unusedHeightValue = height; // Prevent dead code elimination. + var asyncTime = 1; self._writeMark(suite.name + '.' + test.name + '-async-end'); - callback(syncTime, endTime - startTime, height); + callback(syncTime, asyncTime); }, 0); } diff --git a/third_party/webkit/PerformanceTests/StyleBench/resources/style-bench.js b/third_party/webkit/PerformanceTests/StyleBench/resources/style-bench.js index f2dc17596f29..201ccbabe3f6 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/resources/style-bench.js +++ b/third_party/webkit/PerformanceTests/StyleBench/resources/style-bench.js @@ -19,6 +19,8 @@ class Random chance(chance) { + if (!chance) + return false; return this.underOne() < chance; } @@ -72,9 +74,12 @@ class StyleBench repeatingSequenceChance: 0.2, repeatingSequenceMaximumLength: 3, leafMutationChance: 0.1, + mediaQueryChance: 0, + mediaQueryCloseChance: 0, styleSeed: 1, domSeed: 2, stepCount: 5, + isResizeTest: false, mutationsPerStep: 100, }; } @@ -132,6 +137,18 @@ class StyleBench }); } + static mediaQueryConfiguration() + { + return Object.assign(this.defaultConfiguration(), { + name: 'Dynamic media queries', + isResizeTest : true, + mediaQueryChance: 0.01, + mediaQueryCloseChance: 0.3, + starChance: 0, + elementCount: 5000, + }); + } + static predefinedConfigurations() { return [ @@ -140,6 +157,7 @@ class StyleBench this.structuralPseudoClassConfiguration(), this.nthPseudoClassConfiguration(), this.beforeAndAfterConfiguration(), + this.mediaQueryConfiguration(), ]; } @@ -310,11 +328,33 @@ class StyleBench return selector + " { " + this.makeDeclaration(selector) + " }"; } + makeMediaQuery() + { + let width = this.random.number(500); + width = 300 + width - (width % 100); + if (this.random.chance(0.5)) + return `@media (min-width: ${width}px) {`; + return `@media (max-width: ${width}px) {`; + } + makeStylesheet(size) { let cssText = ""; - for (let i = 0; i < size; ++i) + + let inMediaQuery = false; + for (let i = 0; i < size; ++i) { + if (!inMediaQuery && this.random.chance(this.configuration.mediaQueryChance)) { + cssText += this.makeMediaQuery() + "\n";; + inMediaQuery = true; + } + cssText += this.makeRule() + "\n"; + + if (inMediaQuery && this.random.chance(this.configuration.mediaQueryCloseChance)) { + cssText += "}\n"; + inMediaQuery = false; + } + } return cssText; } @@ -496,6 +536,11 @@ class StyleBench } } + resizeViewToWidth(width) + { + window.frameElement.style.width = width + "px"; + } + async runForever() { while (true) { diff --git a/third_party/webkit/PerformanceTests/StyleBench/resources/tests.js b/third_party/webkit/PerformanceTests/StyleBench/resources/tests.js index 85778316fad7..e9c42b027b57 100644 --- a/third_party/webkit/PerformanceTests/StyleBench/resources/tests.js +++ b/third_party/webkit/PerformanceTests/StyleBench/resources/tests.js @@ -1,7 +1,15 @@ function makeSteps(configuration) { const steps = []; - for (i = 0; i < configuration.stepCount; ++i) { + for (let i = 0; i < configuration.stepCount; ++i) { + if (configuration.isResizeTest) { + for (let width = 300; width <= 800; width += 50) { + steps.push(new BenchmarkTestStep(`Resizing to ${width}px - ${i}`, (bench, contentWindow, contentDocument) => { + bench.resizeViewToWidth(width); + })); + } + continue; + } steps.push(new BenchmarkTestStep(`Adding classes - ${i}`, (bench, contentWindow, contentDocument) => { bench.addClasses(configuration.mutationsPerStep); }));