<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166462] trunk/PerformanceTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166462">166462</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-03-30 09:53:53 -0700 (Sun, 30 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>LongSpider 3d-morph result check is inappropriate.
&lt;https://webkit.org/b/130928&gt;

Reviewed by Filip Pizlo.

The LongSpider 3d-morph component expected result check is incorrect.
The existing test checks if the leading digit of a sum starts with &quot;-1&quot;.
However, it turned out that the expected sum is in the order of
-1.8735013540549517e-16 (i.e. very close to 0).  With small errors in
the terms of the sum adding up, it is very easy for the resultant sum 
to fluctuate.  There is no guarantee that the resultant sum's most
significant digit will start with -1 either.

The fix is to do a tolerance check on all the terms of the sum as well
as the total sum value instead.  The tolerance should be more lenient
for the sum which accumulates error from the individual terms, then for
individual terms.

* LongSpider/3d-morph.js:
(expect):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
<li><a href="#trunkPerformanceTestsLongSpider3dmorphjs">trunk/PerformanceTests/LongSpider/3d-morph.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (166461 => 166462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2014-03-30 10:48:32 UTC (rev 166461)
+++ trunk/PerformanceTests/ChangeLog        2014-03-30 16:53:53 UTC (rev 166462)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-03-29  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        LongSpider 3d-morph result check is inappropriate.
+        &lt;https://webkit.org/b/130928&gt;
+
+        Reviewed by Filip Pizlo.
+
+        The LongSpider 3d-morph component expected result check is incorrect.
+        The existing test checks if the leading digit of a sum starts with &quot;-1&quot;.
+        However, it turned out that the expected sum is in the order of
+        -1.8735013540549517e-16 (i.e. very close to 0).  With small errors in
+        the terms of the sum adding up, it is very easy for the resultant sum 
+        to fluctuate.  There is no guarantee that the resultant sum's most
+        significant digit will start with -1 either.
+
+        The fix is to do a tolerance check on all the terms of the sum as well
+        as the total sum value instead.  The tolerance should be more lenient
+        for the sum which accumulates error from the individual terms, then for
+        individual terms.
+
+        * LongSpider/3d-morph.js:
+        (expect):
+
</ins><span class="cx"> 2014-03-28  Zoltan Horvath  &lt;zoltan@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] Add performance tests for Shapes with Regions
</span></span></pre></div>
<a id="trunkPerformanceTestsLongSpider3dmorphjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/LongSpider/3d-morph.js (166461 => 166462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/LongSpider/3d-morph.js        2014-03-30 10:48:32 UTC (rev 166461)
+++ trunk/PerformanceTests/LongSpider/3d-morph.js        2014-03-30 16:53:53 UTC (rev 166462)
</span><span class="lines">@@ -48,16 +48,159 @@
</span><span class="cx">     morph(a, i/loops)
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-testOutput = 0;
-for (var i = 0; i &lt; nx; i++)
-    testOutput += a[3*(i*nx+i)+1];
-a = null;
-
</del><span class="cx"> // This has to be an approximate test since ECMAscript doesn't formally specify
</span><span class="cx"> // what sin() returns. Even if it did specify something like for example what Java 7
</span><span class="cx"> // says - that sin() has to return a value within 1 ulp of exact - then we still
</span><span class="cx"> // would not be able to do an exact test here since that would allow for just enough
</span><span class="cx"> // low-bit slop to create possibly big errors due to testOutput being a sum.
</span><del>-var expected = &quot;-1&quot;;
-if ((&quot;&quot; + testOutput).indexOf(expected) != 0)
-    throw &quot;Error: bad test output: expected leading digit to be &quot; + expected + &quot; but got &quot; + testOutput;
</del><ins>+
+var expectedResults = [
+    { value: 0.018662099703860055, total: 0.018662099703860055 }, // 0
+    { value: 0, total: 0.018662099703860055 }, // 1
+    { value: -0.018662099703860055, total: 0 }, // 2
+    { value: -0.03650857609997156, total: -0.03650857609997156 }, // 3
+    { value: -0.05275945253292943, total: -0.08926802863290098 }, // 4
+    { value: -0.06670448772225647, total: -0.15597251635515746 }, // 5
+    { value: -0.07773421671447613, total: -0.23370673306963358 }, // 6
+    { value: -0.08536658742611654, total: -0.3190733204957501 }, // 7
+    { value: -0.08926802863290098, total: -0.40834134912865105 }, // 8
+    { value: -0.089268028632901, total: -0.49760937776155206 }, // 9
+    { value: -0.08536658742611655, total: -0.5829759651876686 }, // 10
+    { value: -0.07773421671447614, total: -0.6607101819021447 }, // 11
+    { value: -0.06670448772225651, total: -0.7274146696244013 }, // 12
+    { value: -0.052759452532929435, total: -0.7801741221573307 }, // 13
+    { value: -0.03650857609997158, total: -0.8166826982573023 }, // 14
+    { value: -0.018662099703860093, total: -0.8353447979611625 }, // 15
+    { value: -1.0992398059873222e-17, total: -0.8353447979611625 }, // 16
+    { value: 0.018662099703860034, total: -0.8166826982573024 }, // 17
+    { value: 0.036508576099971525, total: -0.780174122157331 }, // 18
+    { value: 0.052759452532929414, total: -0.7274146696244015 }, // 19
+    { value: 0.06670448772225647, total: -0.660710181902145 }, // 20
+    { value: 0.0777342167144761, total: -0.5829759651876689 }, // 21
+    { value: 0.08536658742611654, total: -0.4976093777615524 }, // 22
+    { value: 0.08926802863290098, total: -0.4083413491286514 }, // 23
+    { value: 0.089268028632901, total: -0.3190733204957504 }, // 24
+    { value: 0.08536658742611655, total: -0.23370673306963383 }, // 25
+    { value: 0.07773421671447615, total: -0.1559725163551577 }, // 26
+    { value: 0.06670448772225653, total: -0.08926802863290116 }, // 27
+    { value: 0.052759452532929435, total: -0.036508576099971726 }, // 28
+    { value: 0.03650857609997163, total: -9.71445146547012e-17 }, // 29
+    { value: 0.018662099703860107, total: 0.01866209970386001 }, // 30
+    { value: 2.1984796119746444e-17, total: 0.01866209970386003 }, // 31
+    { value: -0.018662099703859986, total: 4.5102810375396984e-17 }, // 32
+    { value: -0.03650857609997152, total: -0.036508576099971476 }, // 33
+    { value: -0.05275945253292941, total: -0.08926802863290088 }, // 34
+    { value: -0.06670448772225643, total: -0.1559725163551573 }, // 35
+    { value: -0.0777342167144761, total: -0.2337067330696334 }, // 36
+    { value: -0.08536658742611652, total: -0.31907332049574993 }, // 37
+    { value: -0.08926802863290098, total: -0.40834134912865094 }, // 38
+    { value: -0.089268028632901, total: -0.49760937776155195 }, // 39
+    { value: -0.08536658742611655, total: -0.5829759651876685 }, // 40
+    { value: -0.07773421671447617, total: -0.6607101819021446 }, // 41
+    { value: -0.06670448772225658, total: -0.7274146696244012 }, // 42
+    { value: -0.05275945253292945, total: -0.7801741221573306 }, // 43
+    { value: -0.03650857609997164, total: -0.8166826982573022 }, // 44
+    { value: -0.018662099703860194, total: -0.8353447979611625 }, // 45
+    { value: -3.2977194179619666e-17, total: -0.8353447979611625 }, // 46
+    { value: 0.018662099703859975, total: -0.8166826982573024 }, // 47
+    { value: 0.036508576099971435, total: -0.7801741221573311 }, // 48
+    { value: 0.0527594525329294, total: -0.7274146696244017 }, // 49
+    { value: 0.06670448772225643, total: -0.6607101819021453 }, // 50
+    { value: 0.07773421671447606, total: -0.5829759651876691 }, // 51
+    { value: 0.08536658742611652, total: -0.4976093777615526 }, // 52
+    { value: 0.08926802863290097, total: -0.40834134912865167 }, // 53
+    { value: 0.08926802863290101, total: -0.31907332049575066 }, // 54
+    { value: 0.08536658742611655, total: -0.2337067330696341 }, // 55
+    { value: 0.07773421671447617, total: -0.15597251635515794 }, // 56
+    { value: 0.06670448772225658, total: -0.08926802863290136 }, // 57
+    { value: 0.052759452532929456, total: -0.0365085760999719 }, // 58
+    { value: 0.03650857609997165, total: -2.498001805406602e-16 }, // 59
+    { value: 0.018662099703860208, total: 0.018662099703859958 }, // 60
+    { value: 4.396959223949289e-17, total: 0.018662099703860003 }, // 61
+    { value: -0.01866209970385996, total: 4.163336342344337e-17 }, // 62
+    { value: -0.03650857609997142, total: -0.03650857609997138 }, // 63
+    { value: -0.0527594525329294, total: -0.08926802863290079 }, // 64
+    { value: -0.06670448772225641, total: -0.1559725163551572 }, // 65
+    { value: -0.07773421671447604, total: -0.23370673306963324 }, // 66
+    { value: -0.08536658742611652, total: -0.31907332049574977 }, // 67
+    { value: -0.08926802863290097, total: -0.4083413491286507 }, // 68
+    { value: -0.08926802863290101, total: -0.49760937776155173 }, // 69
+    { value: -0.08536658742611655, total: -0.5829759651876683 }, // 70
+    { value: -0.07773421671447618, total: -0.6607101819021445 }, // 71
+    { value: -0.06670448772225658, total: -0.727414669624401 }, // 72
+    { value: -0.05275945253292948, total: -0.7801741221573305 }, // 73
+    { value: -0.036508576099971664, total: -0.8166826982573022 }, // 74
+    { value: -0.018662099703860215, total: -0.8353447979611625 }, // 75
+    { value: -5.496199029936611e-17, total: -0.8353447979611625 }, // 76
+    { value: 0.01866209970385995, total: -0.8166826982573026 }, // 77
+    { value: 0.036508576099971414, total: -0.7801741221573312 }, // 78
+    { value: 0.05275945253292938, total: -0.7274146696244018 }, // 79
+    { value: 0.0667044877222563, total: -0.6607101819021455 }, // 80
+    { value: 0.07773421671447604, total: -0.5829759651876695 }, // 81
+    { value: 0.08536658742611652, total: -0.49760937776155295 }, // 82
+    { value: 0.08926802863290097, total: -0.408341349128652 }, // 83
+    { value: 0.08926802863290101, total: -0.319073320495751 }, // 84
+    { value: 0.08536658742611655, total: -0.23370673306963444 }, // 85
+    { value: 0.07773421671447626, total: -0.1559725163551582 }, // 86
+    { value: 0.0667044877222566, total: -0.08926802863290159 }, // 87
+    { value: 0.05275945253292948, total: -0.036508576099972115 }, // 88
+    { value: 0.036508576099971816, total: -2.983724378680108e-16 }, // 89
+    { value: 0.018662099703860225, total: 0.018662099703859927 }, // 90
+    { value: 6.595438835923933e-17, total: 0.018662099703859993 }, // 91
+    { value: -0.018662099703859788, total: 2.0469737016526324e-16 }, // 92
+    { value: -0.0365085760999714, total: -0.0365085760999712 }, // 93
+    { value: -0.052759452532929366, total: -0.08926802863290056 }, // 94
+    { value: -0.06670448772225629, total: -0.15597251635515685 }, // 95
+    { value: -0.07773421671447604, total: -0.2337067330696329 }, // 96
+    { value: -0.08536658742611652, total: -0.31907332049574944 }, // 97
+    { value: -0.08926802863290095, total: -0.4083413491286504 }, // 98
+    { value: -0.08926802863290101, total: -0.4976093777615514 }, // 99
+    { value: -0.08536658742611657, total: -0.5829759651876679 }, // 100
+    { value: -0.07773421671447626, total: -0.6607101819021441 }, // 101
+    { value: -0.06670448772225661, total: -0.7274146696244007 }, // 102
+    { value: -0.052759452532929484, total: -0.7801741221573302 }, // 103
+    { value: -0.03650857609997182, total: -0.816682698257302 }, // 104
+    { value: -0.01866209970386024, total: -0.8353447979611622 }, // 105
+    { value: -7.694678641911255e-17, total: -0.8353447979611623 }, // 106
+    { value: 0.018662099703859774, total: -0.8166826982573026 }, // 107
+    { value: 0.0365085760999714, total: -0.7801741221573312 }, // 108
+    { value: 0.05275945253292936, total: -0.7274146696244018 }, // 109
+    { value: 0.06670448772225629, total: -0.6607101819021455 }, // 110
+    { value: 0.07773421671447603, total: -0.5829759651876695 }, // 111
+    { value: 0.08536658742611652, total: -0.49760937776155295 }, // 112
+    { value: 0.08926802863290095, total: -0.408341349128652 }, // 113
+    { value: 0.08926802863290101, total: -0.319073320495751 }, // 114
+    { value: 0.08536658742611657, total: -0.2337067330696344 }, // 115
+    { value: 0.07773421671447626, total: -0.15597251635515813 }, // 116
+    { value: 0.06670448772225661, total: -0.08926802863290152 }, // 117
+    { value: 0.0527594525329295, total: -0.036508576099972025 }, // 118
+    { value: 0.03650857609997184, total: -1.8735013540549517e-16 }, // 119
+];
+
+var valueError = 0.00000000000001;
+var totalError = 0.0000000000001;
+
+function expect(i, value, total) {
+    var data = expectedResults;
+    var valueDiff = Math.abs(value - data[i].value);
+    var totalDiff = Math.abs(total - data[i].total);
+
+    var err = null;
+    if (valueDiff &gt; valueError &amp;&amp; totalDiff &gt; totalError)
+        err = &quot;    [&quot; + i + &quot;] value a:&quot; + value + &quot; e:&quot; + data[i].value + &quot; | d:&quot; + valueDiff + &quot;, total a:&quot; + total + &quot; e:&quot; + data[i].total + &quot; | d: &quot; + totalDiff;
+    else if (valueDiff &gt; valueError)
+        err = &quot;    [&quot; + i + &quot;] value a:&quot; + value + &quot; e:&quot; + data[i].value + &quot; | d:&quot; + valueDiff;
+    else if (totalDiff &gt; totalError)
+        err = &quot;    [&quot; + i + &quot;] total a:&quot; + total + &quot; e:&quot; + data[i].total + &quot; | d: &quot; + totalDiff;
+
+    if (err)
+        throw err;
+}
+
+testOutput = 0;
+for (var i = 0; i &lt; nx; i++) {
+    var value = a[3*(i*nx+i)+1];
+    testOutput += value;
+    expect(i, value, testOutput);
+}
+a = null;
</ins></span></pre>
</div>
</div>

</body>
</html>