Changeset 196415 in webkit


Ignore:
Timestamp:
Feb 10, 2016 11:42:00 PM (8 years ago)
Author:
jonlee@apple.com
Message:

Add new benchmark tests.
https://bugs.webkit.org/show_bug.cgi?id=154063

Provisionally reviewed by Said Abou-Hallawa.

Add tests for get/put image data, filters, opacity, and css transforms.

  • Animometer/resources/runner/benchmark-runner.js:

(_runBenchmarkAndRecordResults): Update the body background color to match that of
the stage.
(this._runNextIteration): Clear the background color style for the results page.

  • Animometer/resources/runner/tests.js:
  • Animometer/tests/master/focus.html: Added.
  • Animometer/tests/master/image-data.html: Added.
  • Animometer/tests/master/multiply.html: Added.
  • Animometer/tests/master/resources/focus.js: Added.
  • Animometer/tests/master/resources/image-data.js: Added.
  • Animometer/tests/master/resources/multiply.js: Added.
  • Animometer/tests/master/resources/stage.css: Move common styles out.
  • Animometer/tests/resources/main.js: Update Stage.randomBool to use Math.random.

Add Stage.randomSign for randomly setting a direction. Add the notion of the
current timestamp of the test to Benchmark, since some animations cycle through
colors and rely on an incremental counter like the time.

Location:
trunk/PerformanceTests
Files:
6 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/Animometer/resources/extensions.js

    r196381 r196415  
    8484        return element;
    8585    },
    86    
     86
    8787    browserPrefix: function()
    8888    {
    8989        // Get the HTML element's CSSStyleDeclaration
    9090        var styles = window.getComputedStyle(document.documentElement, '');
    91        
     91
    9292        // Convert the styles list to an array
    9393        var stylesArray = Array.prototype.slice.call(styles);
    94        
     94
    9595        // Concatenate all the styles in one big string
    9696        var stylesString = stylesArray.join('');
     
    9898        // Search the styles string for a known prefix type, settle on Opera if none is found.
    9999        var prefixes = stylesString.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']);
    100        
     100
    101101        // prefixes has two elements; e.g. for webkit it has ['-webkit-', 'webkit'];
    102102        var prefix = prefixes[1];
     
    113113        };
    114114    },
    115    
     115
    116116    setElementPrefixedProperty: function(element, property, value)
    117117    {
    118118        element.style[property] = element.style[this.browserPrefix().js + property[0].toUpperCase() + property.substr(1)] = value;
     119    },
     120
     121    progressValue: function(value, min, max)
     122    {
     123        return (value - min) / (max - min);
     124    },
     125
     126    lerp: function(value, min, max)
     127    {
     128        return min + (max - min) * value;
    119129    }
    120130};
  • trunk/PerformanceTests/Animometer/resources/runner/benchmark-runner.js

    r196304 r196415  
    9595
    9696        var benchmark = new contentWindow.benchmarkClass(options);
     97        document.body.style.backgroundColor = benchmark.backgroundColor();
    9798        benchmark.run().then(function(results) {
    9899            var suiteResults = self._suitesResults[suite.name] || {};
     
    154155            if (currentIteration < self._client.iterationCount)
    155156                self.runAllSteps();
    156             else if (this._client && this._client.didFinishLastIteration)
     157            else if (this._client && this._client.didFinishLastIteration) {
     158                document.body.style.backgroundColor = "";
    157159                self._client.didFinishLastIteration();
     160            }
    158161        }
    159162
  • trunk/PerformanceTests/Animometer/resources/runner/tests.js

    r194756 r196415  
    1414    [
    1515        {
     16            url: "master/multiply.html",
     17            name: "Multiply"
     18        },
     19        {
    1620            url: "master/canvas-stage.html?pathType=arcs",
    1721            name: "Canvas arcs"
     
    2428            url: "master/canvas-stage.html?pathType=line&lineCap=square",
    2529            name: "Canvas line segments"
     30        },
     31        {
     32            url: "master/focus.html",
     33            name: "Focus"
     34        },
     35        {
     36            url: "master/image-data.html",
     37            name: "Images"
    2638        },
    2739        {
  • trunk/PerformanceTests/Animometer/tests/master/resources/stage.css

    r194408 r196415  
    99    padding: 0;
    1010    background-color: rgb(241, 241, 241);
     11    font-family: -apple-system, "Helvetica Neue", Helvetica, Verdana, sans-serif;
    1112}
    1213
    1314#stage {
    14   width: 100%;
    15   height: 100%;
    16   background-color: rgb(241, 241, 241);
     15    position: relative;
     16    width: 100%;
     17    height: 100%;
     18    background-color: rgb(241, 241, 241);
    1719}
     20
     21#center-text {
     22    position: absolute;
     23    z-index: 3;
     24    top: 50%;
     25    left: 50%;
     26    transform: translateX(-50%) translateY(-50%);
     27}
  • trunk/PerformanceTests/Animometer/tests/resources/main.js

    r196381 r196415  
    728728    randomBool: function()
    729729    {
    730         return !!Math.round(this.random(0, 1));
     730        return !!Math.round(Math.random());
     731    },
     732
     733    randomSign: function()
     734    {
     735        return Math.random() >= .5 ? 1 : -1;
    731736    },
    732737
     
    907912    },
    908913
     914    get timestamp()
     915    {
     916        return this._currentTimestamp - this._startTimestamp;
     917    },
     918
     919    backgroundColor: function()
     920    {
     921        var stage = window.getComputedStyle(document.getElementById("stage"));
     922        return stage["background-color"];
     923    },
     924
    909925    run: function()
    910926    {
     
    939955            if (this._currentTimestamp - this._previousTimestamp >= 100) {
    940956                this._didWarmUp = true;
     957                this._startTimestamp = this._currentTimestamp;
    941958                this._controller.start(this._currentTimestamp, this._stage);
    942959                this._previousTimestamp = this._currentTimestamp;
  • trunk/PerformanceTests/ChangeLog

    r196381 r196415  
     12016-02-10  Jon Lee  <jonlee@apple.com>
     2
     3        Add new benchmark tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=154063
     5
     6        Provisionally reviewed by Said Abou-Hallawa.
     7
     8        Add tests for get/put image data, filters, opacity, and css transforms.
     9
     10        * Animometer/resources/runner/benchmark-runner.js:
     11        (_runBenchmarkAndRecordResults): Update the body background color to match that of
     12        the stage.
     13        (this._runNextIteration): Clear the background color style for the results page.
     14        * Animometer/resources/runner/tests.js:
     15        * Animometer/tests/master/focus.html: Added.
     16        * Animometer/tests/master/image-data.html: Added.
     17        * Animometer/tests/master/multiply.html: Added.
     18        * Animometer/tests/master/resources/focus.js: Added.
     19        * Animometer/tests/master/resources/image-data.js: Added.
     20        * Animometer/tests/master/resources/multiply.js: Added.
     21        * Animometer/tests/master/resources/stage.css: Move common styles out.
     22        * Animometer/tests/resources/main.js: Update Stage.randomBool to use Math.random.
     23        Add Stage.randomSign for randomly setting a direction. Add the notion of the
     24        current timestamp of the test to Benchmark, since some animations cycle through
     25        colors and rely on an incremental counter like the time.
     26
    1272016-02-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
    228
     
    834        * Animometer/resources/debug-runner/tests.js: Include the new tests in the
    935        "HTML suite" of the debug runner.
    10        
     36
    1137        * Animometer/resources/extensions.js:
    1238        (Utilities.browserPrefix):
    1339        (Utilities.setElementPrefixedProperty): Utility functions to allow setting
    1440        prefixed style properties.
    15        
     41
    1642        * Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
    1743        Set the mix-blend-mode and the filter to some random values if the options
    1844        of the test requested that.
    19        
     45
    2046        * Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
    2147        (parseShapeParameters): Parse the url options "blend" and "filter" and set
    2248        the corresponding flags.
    23        
     49
    2450        * Animometer/tests/resources/main.js:
    2551        (randomStyleMixBlendMode):
Note: See TracChangeset for help on using the changeset viewer.