RESOLVED FIXED 180140
Add StyleBench
https://bugs.webkit.org/show_bug.cgi?id=180140
Summary Add StyleBench
Antti Koivisto
Reported 2017-11-29 07:42:30 PST
StyleBench is a benchmark for testing style resolution performance.
Attachments
patch (28.47 KB, patch)
2017-11-29 08:17 PST, Antti Koivisto
simon.fraser: review+
patch (28.44 KB, patch)
2017-11-30 03:58 PST, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2017-11-29 08:17:59 PST
Antti Koivisto
Comment 2 2017-11-29 08:21:08 PST
Simon Fraser (smfr)
Comment 3 2017-11-29 11:41:35 PST
Comment on attachment 327854 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=327854&action=review > PerformanceTests/StyleBench/InteractiveRunner.html:21 > +function formatTestName(suiteName, testName) { Opening function parens on new line please (everywhere) > PerformanceTests/StyleBench/InteractiveRunner.html:42 > + label.appendChild(document.createTextNode(formatTestName(suite.name))); or just set textContent? > PerformanceTests/StyleBench/InteractiveRunner.html:53 > + anchor.appendChild(document.createTextNode(formatTestName(suite.name, test.name))); Set textContent? > PerformanceTests/StyleBench/resources/style-bench.js:26 > +function nextAnimationFrame() { return new Promise((resolve) => requestAnimationFrame(resolve)); } No reason to have this all on one line.
Joseph Pecoraro
Comment 4 2017-11-29 13:02:08 PST
Comment on attachment 327854 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=327854&action=review Neat! I skipped the test runner stuff but the rest looked good to me. > PerformanceTests/StyleBench/resources/style-bench.js:32 > + const configuration = { Style: You could just `return` instead of using the local which you immediately return. > PerformanceTests/StyleBench/resources/style-bench.js:79 > + let configuration = this.defaultConfiguration(); > + configuration.name = 'Sibling combinators'; > + configuration.combinators = [ > + ' ', > + ' ', > + '>', > + '>', > + '~', > + '+', > + ]; > + return configuration; Another way to write these configuration functions would be to use `Object.assign` to add/override additional properties on the default configuration. Like so: return Object.assign(this.defaultConfiguration(), { name: 'Sibling combinators', combinators: [' ', ' ', '>', '>', '~', '+'], }); But use the approach you find easiest to read! Also there is an inconsistent mix of single quoted and double quoted strings. We normally prefer to be consistent within a single file. > PerformanceTests/StyleBench/resources/style-bench.js:116 > + ]; I'd be interested to see one that includes `:matches()`, `:all()`, `:not()` pseudo classeses in the future! We make use of that a lot in Web Inspector. If there was one for `var()` where custom properties have different values after mutation would that spend most of its time in style resolution as well, or not to the same degree? > PerformanceTests/StyleBench/resources/style-bench.js:299 > + Style: Unnecessary blank line. > PerformanceTests/StyleBench/resources/style-bench.js:348 > + const classList = element.classList; > + classList.add(this.randomClassName()); > + > + const canRemove = classList.length; > + if (!canRemove) > + continue; Because line 344 just added a class name it seems `classList.length` would never be 0, right? So I think you can drop lines 346-348 and even make this a straight for loop by moving the increment into the for loop header. Or perhaps line 344 is an accident of a copy/paste from addClasses? > PerformanceTests/StyleBench/resources/tests.js:22 > + const suite = { Style: Same as before, you can drop the temporary local and just `return`.
Antti Koivisto
Comment 5 2017-11-29 14:16:22 PST
> Also there is an inconsistent mix of single quoted and double quoted > strings. We normally prefer to be consistent within a single file. Do we have a preference? > > PerformanceTests/StyleBench/resources/style-bench.js:116 > > + ]; > > I'd be interested to see one that includes `:matches()`, `:all()`, `:not()` > pseudo classeses in the future! We make use of that a lot in Web Inspector. Yeah. It will be easy to add more cases. Thanks for the comments!
Antti Koivisto
Comment 6 2017-11-30 03:58:06 PST
Antti Koivisto
Comment 7 2017-11-30 04:03:25 PST
> > PerformanceTests/StyleBench/InteractiveRunner.html:21 I didn't do any fixes to this copy-code from Speedometer.
WebKit Commit Bot
Comment 8 2017-11-30 04:30:28 PST
Comment on attachment 327967 [details] patch Clearing flags on attachment: 327967 Committed r225324: <https://trac.webkit.org/changeset/225324>
WebKit Commit Bot
Comment 9 2017-11-30 04:30:30 PST
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 10 2017-11-30 14:39:54 PST
StyleBench is failing on the perf bot: Running StyleBench/InteractiveRunner.html (184 of 184) ERROR: layer at (0,0) size 785x630 FAILED Finished: 0.873694 s https://build.webkit.org/builders/Apple%20El%20Capitan%20Release%20WK2%20%28Perf%29/builds/1742
Antti Koivisto
Comment 11 2017-12-01 07:32:32 PST
Skipped InteractiveRunner.html in https://trac.webkit.org/r225392
Note You need to log in before you can comment on or make changes to this bug.