Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/tests/performance/common.js

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 function runTests(testFunc, cleanupFunc, finalizeFunc) 1 function runTests(testFunc, cleanupFunc, finalizeFunc)
2 { 2 {
3 const minRuns = 15; 3 const minRuns = 15;
4 const maxRuns = 400; 4 const maxRuns = 400;
5 const targetConfidenceInterval = 0.04; 5 const targetConfidenceInterval = 0.04;
6 6
7 let currentRun = 0; 7 let currentRun = 0;
8 let results = []; 8 let results = [];
9 function runNextTest() 9 function runNextTest()
10 { 10 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 setTimeout(runNextTest, 0); 44 setTimeout(runNextTest, 0);
45 } 45 }
46 46
47 function getConfidenceInterval(results) 47 function getConfidenceInterval(results)
48 { 48 {
49 let sum = 0; 49 let sum = 0;
50 let sqrsum = 0; 50 let sqrsum = 0;
51 51
52 for each (let result in results) 52 for (let result of results)
53 { 53 {
54 sum += result; 54 sum += result;
55 sqrsum += result * result; 55 sqrsum += result * result;
56 } 56 }
57 57
58 let avg = sum / results.length; 58 let avg = sum / results.length;
59 let stddev = Math.sqrt((sqrsum - 2 * sum * avg + avg * avg * results.length) / results.length); 59 let stddev = Math.sqrt((sqrsum - 2 * sum * avg + avg * avg * results.length) / results.length);
60 let confidence = 1.96 * stddev; // 95% confidence, assuming Gaussian distribut ion 60 let confidence = 1.96 * stddev; // 95% confidence, assuming Gaussian distribut ion
61 return [avg, stddev]; 61 return [avg, stddev];
62 } 62 }
OLDNEW
« no previous file with comments | « chrome/content/tests/notification.js ('k') | chrome/content/tests/performance/filter_fromText.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld