Add a performance test for hit testing in SVG
authorpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2012 18:45:32 +0000 (18:45 +0000)
committerpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2012 18:45:32 +0000 (18:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90811

Reviewed by Ryosuke Niwa.

The shape rendering code is changing a lot and I'd like a performance test to
make sure we don't regress, and to track our improvements.

Performance results in my Linux desktop:
    RESULT SVG: SvgHitTesting= 105.0 ms
    median= 103.5 ms, stdev= 4.60434577329 ms, min= 101.0 ms, max= 116.0 ms

    RESULT SVG: SvgHitTesting= 97.8 ms
    median= 96.5 ms, stdev= 2.67581763205 ms, min= 95.0 ms, max= 102.0 ms

    RESULT SVG: SvgHitTesting= 104.3 ms
    median= 104.0 ms, stdev= 1.41774468788 ms, min= 102.0 ms, max= 107.0 ms

    RESULT SVG: SvgHitTesting= 103.6 ms
    median= 103.5 ms, stdev= 1.2 ms, min= 102.0 ms, max= 106.0 ms

* SVG/SvgHitTesting.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122351 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/SVG/SvgHitTesting.html [new file with mode: 0644]

index ef35dae..391a82c 100644 (file)
@@ -1,3 +1,28 @@
+2012-07-11  Philip Rogers  <pdr@google.com>
+
+        Add a performance test for hit testing in SVG
+        https://bugs.webkit.org/show_bug.cgi?id=90811
+
+        Reviewed by Ryosuke Niwa.
+
+        The shape rendering code is changing a lot and I'd like a performance test to
+        make sure we don't regress, and to track our improvements.
+
+        Performance results in my Linux desktop:
+            RESULT SVG: SvgHitTesting= 105.0 ms
+            median= 103.5 ms, stdev= 4.60434577329 ms, min= 101.0 ms, max= 116.0 ms
+
+            RESULT SVG: SvgHitTesting= 97.8 ms
+            median= 96.5 ms, stdev= 2.67581763205 ms, min= 95.0 ms, max= 102.0 ms
+
+            RESULT SVG: SvgHitTesting= 104.3 ms
+            median= 104.0 ms, stdev= 1.41774468788 ms, min= 102.0 ms, max= 107.0 ms
+
+            RESULT SVG: SvgHitTesting= 103.6 ms
+            median= 103.5 ms, stdev= 1.2 ms, min= 102.0 ms, max= 106.0 ms
+
+        * SVG/SvgHitTesting.html: Added.
+
 2012-07-03  Jan Keromnes  <janx@linux.com>
 
         Web Inspector: WebInspector.TextViewer should be renamed WebInspector.TextEditor
diff --git a/PerformanceTests/SVG/SvgHitTesting.html b/PerformanceTests/SVG/SvgHitTesting.html
new file mode 100644 (file)
index 0000000..cc58859
--- /dev/null
@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style>
+      body {
+        margin: 0px;
+      }
+      #container {
+        background-color: #eee;
+        width: 600px;
+        height: 400px;
+      }
+      #title {
+        position: absolute;
+        top: 400px;
+        left: 0px;
+        font-family: sans-serif;
+        font-size: 30px;
+        text-align: right;
+        width: 600px;
+      }
+    </style>
+  </head>
+  <body>
+    <div id="wrapper">
+      <div id="title">SVG Hit Testing</div>
+      <div id="container">
+        <svg id="svg" width="600" height="400" xmlns="http://www.w3.org/2000/svg" version="1.0">
+          <g id="shapes1" transform="translate(-60, -20)">
+            <circle cx="100" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="all"/>
+            <circle cx="300" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleFill" />
+            <circle cx="500" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleStroke" />
+            <ellipse cx="100" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="all" />
+            <ellipse cx="300" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleFill" />
+            <ellipse cx="500" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleStroke" />
+            <rect x="50" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="all" />
+            <rect x="250" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleFill" />
+            <rect x="450" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleStroke" />
+            <path d="M50,300 C75,200 75,200 100,300 S125,400 150,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="all" />
+            <path d="M250,300 C275,200 275,200 300,300 S325,400 350,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleFill" />
+            <path d="M450,300 C475,200 475,200 500,300 S525,400 550,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleStroke" />
+          </g>
+          <g id="shapes2" transform="translate(-30, -10)">
+            <circle cx="100" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="all"/>
+            <circle cx="300" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleFill" />
+            <circle cx="500" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleStroke" />
+            <ellipse cx="100" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="all" />
+            <ellipse cx="300" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleFill" />
+            <ellipse cx="500" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleStroke" />
+            <rect x="50" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="all" />
+            <rect x="250" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleFill" />
+            <rect x="450" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleStroke" />
+            <path d="M50,300 C75,200 75,200 100,300 S125,400 150,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="all" />
+            <path d="M250,300 C275,200 275,200 300,300 S325,400 350,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleFill" />
+            <path d="M450,300 C475,200 475,200 500,300 S525,400 550,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleStroke" />
+          </g>
+          <g id="shapes3" transform="translate(0, 0)">
+            <circle cx="100" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="all"/>
+            <circle cx="300" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleFill" />
+            <circle cx="500" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleStroke" />
+            <ellipse cx="100" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="all" />
+            <ellipse cx="300" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleFill" />
+            <ellipse cx="500" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleStroke" />
+            <rect x="50" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="all" />
+            <rect x="250" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleFill" />
+            <rect x="450" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleStroke" />
+            <path d="M50,300 C75,200 75,200 100,300 S125,400 150,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="all" />
+            <path d="M250,300 C275,200 275,200 300,300 S325,400 350,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleFill" />
+            <path d="M450,300 C475,200 475,200 500,300 S525,400 550,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleStroke" />
+          </g>
+          <g id="shapes4" transform="translate(30, 10)">
+            <circle cx="100" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="all"/>
+            <circle cx="300" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleFill" />
+            <circle cx="500" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleStroke" />
+            <ellipse cx="100" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="all" />
+            <ellipse cx="300" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleFill" />
+            <ellipse cx="500" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleStroke" />
+            <rect x="50" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="all" />
+            <rect x="250" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleFill" />
+            <rect x="450" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleStroke" />
+            <path d="M50,300 C75,200 75,200 100,300 S125,400 150,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="all" />
+            <path d="M250,300 C275,200 275,200 300,300 S325,400 350,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleFill" />
+            <path d="M450,300 C475,200 475,200 500,300 S525,400 550,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleStroke" />
+          </g>
+          <g id="shapes5" transform="translate(60, 20)">
+            <circle cx="100" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="all"/>
+            <circle cx="300" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleFill" />
+            <circle cx="500" cy="75" r="40" fill="#feae00" stroke="#f31900" stroke-width="15" pointer-events="visibleStroke" />
+            <ellipse cx="100" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="all" />
+            <ellipse cx="300" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleFill" />
+            <ellipse cx="500" cy="150" rx="50" ry="40" fill="#d4ecfb" stroke="#3364c2" stroke-width="15" pointer-events="visibleStroke" />
+            <rect x="50" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="all" />
+            <rect x="250" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleFill" />
+            <rect x="450" y="175" width="100" height="100" fill="#f7d72b" stroke="#db8409" stroke-width="15" pointer-events="visibleStroke" />
+            <path d="M50,300 C75,200 75,200 100,300 S125,400 150,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="all" />
+            <path d="M250,300 C275,200 275,200 300,300 S325,400 350,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleFill" />
+            <path d="M450,300 C475,200 475,200 500,300 S525,400 550,300" fill="#e0fb00" stroke="#44c400" stroke-width="15" pointer-events="visibleStroke" />
+          </g>
+        </svg>
+      </div>
+    </div>
+    <script src="../resources/runner.js"></script>
+    <script>
+      PerfTestRunner.run(function() {
+        for (var i = 0; i < 6000; i++) {
+          var x = 600 * Math.random();
+          var y = 400 * Math.random();
+          var el = document.elementFromPoint(x, y);
+        }
+      }, 1, 10, function() {
+        var wrapper = document.getElementById('wrapper');
+        if (wrapper)
+          wrapper.parentNode.removeChild(wrapper);
+      });
+    </script>
+  </body>
+</html>