@@ -17,7 +17,7 @@ bp.Statistics.getMean = function (sample) {
17
17
var total = 0 ;
18
18
sample . forEach ( function ( x ) { total += x ; } ) ;
19
19
return total / sample . length ;
20
- }
20
+ } ;
21
21
22
22
bp . Statistics . calculateConfidenceInterval = function ( standardDeviation , sampleSize ) {
23
23
var standardError = standardDeviation / Math . sqrt ( sampleSize ) ;
@@ -143,6 +143,7 @@ bp.runTimedTest = function (bs) {
143
143
} ;
144
144
145
145
bp . runAllTests = function ( done ) {
146
+ var report ;
146
147
if ( bp . runState . iterations -- ) {
147
148
bp . steps . forEach ( function ( bs ) {
148
149
var testResults = bp . runTimedTest ( bs ) ;
@@ -151,14 +152,14 @@ bp.runAllTests = function (done) {
151
152
bp . runState . recentGarbagePerStep [ bs . name ] = testResults . garbage ;
152
153
bp . runState . recentRetainedMemoryPerStep [ bs . name ] = testResults . retainedDelta ;
153
154
} ) ;
154
- bp . report = bp . calcStats ( ) ;
155
- bp . writeReport ( bp . report ) ;
155
+ report = bp . calcStats ( ) ;
156
+ bp . writeReport ( report ) ;
156
157
window . requestAnimationFrame ( function ( ) {
157
158
bp . runAllTests ( done ) ;
158
159
} ) ;
159
160
}
160
161
else {
161
- bp . writeReport ( bp . report ) ;
162
+ bp . writeReport ( report ) ;
162
163
bp . resetIterations ( ) ;
163
164
done && done ( ) ;
164
165
}
@@ -184,15 +185,6 @@ bp.generateReportPartial = function(model) {
184
185
return bp . infoTemplate ( model ) ;
185
186
} ;
186
187
187
- bp . getAverages = function ( times , gcTimes , garbageTimes , retainedTimes ) {
188
- return {
189
- gcTime : bp . Statistics . getMean ( gcTimes ) ,
190
- time : bp . Statistics . getMean ( times ) ,
191
- garbage : bp . Statistics . getMean ( garbageTimes ) ,
192
- retained : bp . Statistics . getMean ( retainedTimes )
193
- } ;
194
- } ;
195
-
196
188
bp . writeReport = function ( reportContent ) {
197
189
bp . infoDiv . innerHTML = reportContent ;
198
190
} ;
@@ -254,11 +246,13 @@ bp.calcStats = function() {
254
246
255
247
tpa . nextEntry ++ ;
256
248
tpa . nextEntry %= bp . runState . numSamples ;
257
- avg = bp . getAverages (
258
- tpa . times ,
259
- tpa . gcTimes ,
260
- tpa . garbageTimes ,
261
- tpa . retainedTimes ) ;
249
+ avg = {
250
+ gcTime : bp . Statistics . getMean ( tpa . gcTimes ) ,
251
+ time : bp . Statistics . getMean ( tpa . times ) ,
252
+ garbage : bp . Statistics . getMean ( tpa . garbageTimes ) ,
253
+ retained : bp . Statistics . getMean ( tpa . retainedTimes )
254
+ } ;
255
+
262
256
timesStandardDeviation = bp . Statistics . calculateStandardDeviation ( tpa . times , avg . time ) ;
263
257
timesConfidenceInterval = bp . Statistics . calculateConfidenceInterval (
264
258
timesStandardDeviation ,
0 commit comments