raspberryGPIOhtmlserver/node_modules/benchmark/doc/README.md
node_modules/benchmark/doc/README.mdRaw
1# Benchmark.js <sup>v1.0.0</sup>
2
3<!-- div -->
4
5
6<!-- div -->
7
8## <a id="Benchmark"></a>`Benchmark`
9* [`Benchmark`](#benchmarkname-fn--options)
10* [`Benchmark.version`](#benchmarkversion)
11* [`Benchmark.deepClone`](#benchmarkdeepclonevalue)
12* [`Benchmark.each`](#benchmarkeachobject-callback-thisarg)
13* [`Benchmark.extend`](#benchmarkextenddestination--source)
14* [`Benchmark.filter`](#benchmarkfilterarray-callback-thisarg)
15* [`Benchmark.forEach`](#benchmarkforeacharray-callback-thisarg)
16* [`Benchmark.formatNumber`](#benchmarkformatnumbernumber)
17* [`Benchmark.forOwn`](#benchmarkforownobject-callback-thisarg)
18* [`Benchmark.hasKey`](#benchmarkhaskeyobject-key)
19* [`Benchmark.indexOf`](#benchmarkindexofarray-value--fromindex0)
20* [`Benchmark.interpolate`](#benchmarkinterpolatestring-object)
21* [`Benchmark.invoke`](#benchmarkinvokebenches-name--arg1-arg2-)
22* [`Benchmark.join`](#benchmarkjoinobject--separator1--separator2:)
23* [`Benchmark.map`](#benchmarkmaparray-callback-thisarg)
24* [`Benchmark.pluck`](#benchmarkpluckarray-property)
25* [`Benchmark.reduce`](#benchmarkreducearray-callback-accumulator)
26
27<!-- /div -->
28
29
30<!-- div -->
31
32## `Benchmark.prototype`
33* [`Benchmark.prototype.aborted`](#benchmarkprototypeaborted)
34* [`Benchmark.prototype.compiled`](#benchmarkprototypecompiled)
35* [`Benchmark.prototype.count`](#benchmarkprototypecount)
36* [`Benchmark.prototype.cycles`](#benchmarkprototypecycles)
37* [`Benchmark.prototype.fn`](#benchmarkprototypefn)
38* [`Benchmark.prototype.hz`](#benchmarkprototypehz)
39* [`Benchmark.prototype.running`](#benchmarkprototyperunning)
40* [`Benchmark.prototype.setup`](#benchmarkprototypesetup)
41* [`Benchmark.prototype.teardown`](#benchmarkprototypeteardown)
42* [`Benchmark.prototype.abort`](#benchmarkprototypeabort)
43* [`Benchmark.prototype.clone`](#benchmarkprototypecloneoptions)
44* [`Benchmark.prototype.compare`](#benchmarkprototypecompareother)
45* [`Benchmark.prototype.emit`](#benchmarkprototypeemittype)
46* [`Benchmark.prototype.listeners`](#benchmarkprototypelistenerstype)
47* [`Benchmark.prototype.off`](#benchmarkprototypeofftype-listener)
48* [`Benchmark.prototype.on`](#benchmarkprototypeontype-listener)
49* [`Benchmark.prototype.reset`](#benchmarkprototypereset)
50* [`Benchmark.prototype.run`](#benchmarkprototyperunoptions)
51* [`Benchmark.prototype.toString`](#benchmarkprototypetostring)
52
53<!-- /div -->
54
55
56<!-- div -->
57
58## `Benchmark.options`
59* [`Benchmark.options`](#benchmarkoptions)
60* [`Benchmark.options.async`](#benchmarkoptionsasync)
61* [`Benchmark.options.defer`](#benchmarkoptionsdefer)
62* [`Benchmark.options.delay`](#benchmarkoptionsdelay)
63* [`Benchmark.options.id`](#benchmarkoptionsid)
64* [`Benchmark.options.initCount`](#benchmarkoptionsinitcount)
65* [`Benchmark.options.maxTime`](#benchmarkoptionsmaxtime)
66* [`Benchmark.options.minSamples`](#benchmarkoptionsminsamples)
67* [`Benchmark.options.minTime`](#benchmarkoptionsmintime)
68* [`Benchmark.options.name`](#benchmarkoptionsname)
69* [`Benchmark.options.onAbort`](#benchmarkoptionsonabort)
70* [`Benchmark.options.onComplete`](#benchmarkoptionsoncomplete)
71* [`Benchmark.options.onCycle`](#benchmarkoptionsoncycle)
72* [`Benchmark.options.onError`](#benchmarkoptionsonerror)
73* [`Benchmark.options.onReset`](#benchmarkoptionsonreset)
74* [`Benchmark.options.onStart`](#benchmarkoptionsonstart)
75
76<!-- /div -->
77
78
79<!-- div -->
80
81## `Benchmark.platform`
82* [`Benchmark.platform`](#benchmarkplatform)
83* [`Benchmark.platform.description`](#benchmarkplatformdescription)
84* [`Benchmark.platform.layout`](#benchmarkplatformlayout)
85* [`Benchmark.platform.manufacturer`](#benchmarkplatformmanufacturer)
86* [`Benchmark.platform.name`](#benchmarkplatformname)
87* [`Benchmark.platform.os`](#benchmarkplatformos)
88* [`Benchmark.platform.prerelease`](#benchmarkplatformprerelease)
89* [`Benchmark.platform.product`](#benchmarkplatformproduct)
90* [`Benchmark.platform.version`](#benchmarkplatformversion)
91* [`Benchmark.platform.toString`](#benchmarkplatformtostring)
92
93<!-- /div -->
94
95
96<!-- div -->
97
98## `Benchmark.support`
99* [`Benchmark.support`](#benchmarksupport)
100* [`Benchmark.support.air`](#benchmarksupportair)
101* [`Benchmark.support.argumentsClass`](#benchmarksupportargumentsclass)
102* [`Benchmark.support.browser`](#benchmarksupportbrowser)
103* [`Benchmark.support.charByIndex`](#benchmarksupportcharbyindex)
104* [`Benchmark.support.charByOwnIndex`](#benchmarksupportcharbyownindex)
105* [`Benchmark.support.decompilation`](#benchmarksupportdecompilation)
106* [`Benchmark.support.descriptors`](#benchmarksupportdescriptors)
107* [`Benchmark.support.getAllKeys`](#benchmarksupportgetallkeys)
108* [`Benchmark.support.iteratesOwnLast`](#benchmarksupportiteratesownfirst)
109* [`Benchmark.support.java`](#benchmarksupportjava)
110* [`Benchmark.support.nodeClass`](#benchmarksupportnodeclass)
111* [`Benchmark.support.timeout`](#benchmarksupporttimeout)
112
113<!-- /div -->
114
115
116<!-- div -->
117
118## `Benchmark.prototype.error`
119* [`Benchmark.prototype.error`](#benchmarkprototypeerror)
120
121<!-- /div -->
122
123
124<!-- div -->
125
126## `Benchmark.prototype.stats`
127* [`Benchmark.prototype.stats`](#benchmarkprototypestats)
128* [`Benchmark.prototype.stats.deviation`](#benchmark-statsdeviation)
129* [`Benchmark.prototype.stats.mean`](#benchmark-statsmean)
130* [`Benchmark.prototype.stats.moe`](#benchmark-statsmoe)
131* [`Benchmark.prototype.stats.rme`](#benchmark-statsrme)
132* [`Benchmark.prototype.stats.sample`](#benchmark-statssample)
133* [`Benchmark.prototype.stats.sem`](#benchmark-statssem)
134* [`Benchmark.prototype.stats.variance`](#benchmark-statsvariance)
135
136<!-- /div -->
137
138
139<!-- div -->
140
141## `Benchmark.prototype.times`
142* [`Benchmark.prototype.times`](#benchmarkprototypetimes)
143* [`Benchmark.prototype.times.cycle`](#benchmark-timescycle)
144* [`Benchmark.prototype.times.elapsed`](#benchmark-timeselapsed)
145* [`Benchmark.prototype.times.period`](#benchmark-timesperiod)
146* [`Benchmark.prototype.times.timeStamp`](#benchmark-timestimestamp)
147
148<!-- /div -->
149
150
151<!-- div -->
152
153## `Benchmark.Deferred`
154* [`Benchmark.Deferred`](#benchmarkdeferredclone)
155
156<!-- /div -->
157
158
159<!-- div -->
160
161## `Benchmark.Deferred.prototype`
162* [`Benchmark.Deferred.prototype.benchmark`](#benchmarkdeferredprototypebenchmark)
163* [`Benchmark.Deferred.prototype.cycles`](#benchmarkdeferredprototypecycles)
164* [`Benchmark.Deferred.prototype.elapsed`](#benchmarkdeferredprototypeelapsed)
165* [`Benchmark.Deferred.prototype.resolve`](#benchmarkdeferredprototyperesolve)
166* [`Benchmark.Deferred.prototype.timeStamp`](#benchmarkdeferredprototypetimestamp)
167
168<!-- /div -->
169
170
171<!-- div -->
172
173## `Benchmark.Event`
174* [`Benchmark.Event`](#benchmarkeventtype)
175
176<!-- /div -->
177
178
179<!-- div -->
180
181## `Benchmark.Event.prototype`
182* [`Benchmark.Event.prototype.aborted`](#benchmarkeventprototypeaborted)
183* [`Benchmark.Event.prototype.cancelled`](#benchmarkeventprototypecancelled)
184* [`Benchmark.Event.prototype.result`](#benchmarkeventprototyperesult)
185* [`Benchmark.Event.prototype.timeStamp`](#benchmarkeventprototypetimestamp)
186* [`Benchmark.Event.prototype.type`](#benchmarkeventprototypetype)
187
188<!-- /div -->
189
190
191<!-- div -->
192
193## `Benchmark.Event.prototype.currentTarget`
194* [`Benchmark.Event.prototype.currentTarget`](#benchmarkeventprototypecurrenttarget)
195
196<!-- /div -->
197
198
199<!-- div -->
200
201## `Benchmark.Event.prototype.target`
202* [`Benchmark.Event.prototype.target`](#benchmarkeventprototypetarget)
203
204<!-- /div -->
205
206
207<!-- div -->
208
209## `Benchmark.Suite`
210* [`Benchmark.Suite`](#benchmarksuitename--options)
211
212<!-- /div -->
213
214
215<!-- div -->
216
217## `Benchmark.Suite.prototype`
218* [`Benchmark.Suite.prototype.aborted`](#benchmarksuiteprototypeaborted)
219* [`Benchmark.Suite.prototype.length`](#benchmarksuiteprototypelength)
220* [`Benchmark.Suite.prototype.running`](#benchmarksuiteprototyperunning)
221* [`Benchmark.Suite.prototype.abort`](#benchmarksuiteprototypeabort)
222* [`Benchmark.Suite.prototype.add`](#benchmarksuiteprototypeaddname-fn--options)
223* [`Benchmark.Suite.prototype.clone`](#benchmarksuiteprototypecloneoptions)
224* [`Benchmark.Suite.prototype.emit`](#benchmarkprototypeemittype)
225* [`Benchmark.Suite.prototype.filter`](#benchmarksuiteprototypefiltercallback)
226* [`Benchmark.Suite.prototype.forEach`](#benchmarksuiteprototypeforeachcallback)
227* [`Benchmark.Suite.prototype.indexOf`](#benchmarksuiteprototypeindexofvalue)
228* [`Benchmark.Suite.prototype.invoke`](#benchmarksuiteprototypeinvokename--arg1-arg2-)
229* [`Benchmark.Suite.prototype.join`](#benchmarksuiteprototypejoinseparator-)
230* [`Benchmark.Suite.prototype.listeners`](#benchmarkprototypelistenerstype)
231* [`Benchmark.Suite.prototype.map`](#benchmarksuiteprototypemapcallback)
232* [`Benchmark.Suite.prototype.off`](#benchmarkprototypeofftype-listener)
233* [`Benchmark.Suite.prototype.on`](#benchmarkprototypeontype-listener)
234* [`Benchmark.Suite.prototype.pluck`](#benchmarksuiteprototypepluckproperty)
235* [`Benchmark.Suite.prototype.pop`](#benchmarksuiteprototypepop)
236* [`Benchmark.Suite.prototype.push`](#benchmarksuiteprototypepush)
237* [`Benchmark.Suite.prototype.reduce`](#benchmarksuiteprototypereducecallback-accumulator)
238* [`Benchmark.Suite.prototype.reset`](#benchmarksuiteprototypereset)
239* [`Benchmark.Suite.prototype.reverse`](#benchmarksuiteprototypereverse)
240* [`Benchmark.Suite.prototype.run`](#benchmarksuiteprototyperunoptions)
241* [`Benchmark.Suite.prototype.shift`](#benchmarksuiteprototypeshift)
242* [`Benchmark.Suite.prototype.slice`](#benchmarksuiteprototypeslicestart-end)
243* [`Benchmark.Suite.prototype.sort`](#benchmarksuiteprototypesortcomparefnnull)
244* [`Benchmark.Suite.prototype.splice`](#benchmarksuiteprototypesplicestart-deletecount--val1-val2-)
245* [`Benchmark.Suite.prototype.unshift`](#benchmarksuiteprototypeunshift)
246
247<!-- /div -->
248
249
250<!-- div -->
251
252## `Benchmark.Suite.options`
253* [`Benchmark.Suite.options`](#benchmarksuiteoptions)
254* [`Benchmark.Suite.options.name`](#benchmarksuiteoptionsname)
255
256<!-- /div -->
257
258
259<!-- /div -->
260
261
262<!-- div -->
263
264
265<!-- div -->
266
267## `Benchmark`
268
269<!-- div -->
270
271### <a id="benchmarkname-fn--options"></a>`Benchmark(name, fn [, options={}])`
272<a href="#benchmarkname-fn--options">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L404 "View in source") [Ⓣ][1]
273
274The Benchmark constructor.
275
276#### Arguments
2771. `name` *(String)*: A name to identify the benchmark.
2782. `fn` *(Function|String)*: The test to benchmark.
2793. `[options={}]` *(Object)*: Options object.
280
281#### Example
282~~~ js
283// basic usage (the `new` operator is optional)
284var bench = new Benchmark(fn);
285
286// or using a name first
287var bench = new Benchmark('foo', fn);
288
289// or with options
290var bench = new Benchmark('foo', fn, {
291
292 // displayed by Benchmark#toString if `name` is not available
293 'id': 'xyz',
294
295 // called when the benchmark starts running
296 'onStart': onStart,
297
298 // called after each run cycle
299 'onCycle': onCycle,
300
301 // called when aborted
302 'onAbort': onAbort,
303
304 // called when a test errors
305 'onError': onError,
306
307 // called when reset
308 'onReset': onReset,
309
310 // called when the benchmark completes running
311 'onComplete': onComplete,
312
313 // compiled/called before the test loop
314 'setup': setup,
315
316 // compiled/called after the test loop
317 'teardown': teardown
318});
319
320// or name and options
321var bench = new Benchmark('foo', {
322
323 // a flag to indicate the benchmark is deferred
324 'defer': true,
325
326 // benchmark test function
327 'fn': function(deferred) {
328 // call resolve() when the deferred test is finished
329 deferred.resolve();
330 }
331});
332
333// or options only
334var bench = new Benchmark({
335
336 // benchmark name
337 'name': 'foo',
338
339 // benchmark test as a string
340 'fn': '[1,2,3,4].sort()'
341});
342
343// a test's `this` binding is set to the benchmark instance
344var bench = new Benchmark('foo', function() {
345 'My name is '.concat(this.name); // My name is foo
346});
347~~~
348
349* * *
350
351<!-- /div -->
352
353
354<!-- div -->
355
356### <a id="benchmarkversion"></a>`Benchmark.version`
357<a href="#benchmarkversion">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3267 "View in source") [Ⓣ][1]
358
359*(String)*: The semantic version number.
360
361* * *
362
363<!-- /div -->
364
365
366<!-- div -->
367
368### <a id="benchmarkdeepclonevalue"></a>`Benchmark.deepClone(value)`
369<a href="#benchmarkdeepclonevalue">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1225 "View in source") [Ⓣ][1]
370
371A deep clone utility.
372
373#### Arguments
3741. `value` *(Mixed)*: The value to clone.
375
376#### Returns
377*(Mixed)*: The cloned value.
378
379* * *
380
381<!-- /div -->
382
383
384<!-- div -->
385
386### <a id="benchmarkeachobject-callback-thisarg"></a>`Benchmark.each(object, callback, thisArg)`
387<a href="#benchmarkeachobject-callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1400 "View in source") [Ⓣ][1]
388
389An iteration utility for arrays and objects. Callbacks may terminate the loop by explicitly returning `false`.
390
391#### Arguments
3921. `object` *(Array|Object)*: The object to iterate over.
3932. `callback` *(Function)*: The function called per iteration.
3943. `thisArg` *(Mixed)*: The `this` binding for the callback.
395
396#### Returns
397*(Array, Object)*: Returns the object iterated over.
398
399* * *
400
401<!-- /div -->
402
403
404<!-- div -->
405
406### <a id="benchmarkextenddestination--source"></a>`Benchmark.extend(destination [, source={}])`
407<a href="#benchmarkextenddestination--source">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1446 "View in source") [Ⓣ][1]
408
409Copies enumerable properties from the source(s) object to the destination object.
410
411#### Arguments
4121. `destination` *(Object)*: The destination object.
4132. `[source={}]` *(Object)*: The source object.
414
415#### Returns
416*(Object)*: The destination object.
417
418* * *
419
420<!-- /div -->
421
422
423<!-- div -->
424
425### <a id="benchmarkfilterarray-callback-thisarg"></a>`Benchmark.filter(array, callback, thisArg)`
426<a href="#benchmarkfilterarray-callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1485 "View in source") [Ⓣ][1]
427
428A generic `Array#filter` like method.
429
430#### Arguments
4311. `array` *(Array)*: The array to iterate over.
4322. `callback` *(Function|String)*: The function/alias called per iteration.
4333. `thisArg` *(Mixed)*: The `this` binding for the callback.
434
435#### Returns
436*(Array)*: A new array of values that passed callback filter.
437
438#### Example
439~~~ js
440// get odd numbers
441Benchmark.filter([1, 2, 3, 4, 5], function(n) {
442 return n % 2;
443}); // -> [1, 3, 5];
444
445// get fastest benchmarks
446Benchmark.filter(benches, 'fastest');
447
448// get slowest benchmarks
449Benchmark.filter(benches, 'slowest');
450
451// get benchmarks that completed without erroring
452Benchmark.filter(benches, 'successful');
453~~~
454
455* * *
456
457<!-- /div -->
458
459
460<!-- div -->
461
462### <a id="benchmarkforeacharray-callback-thisarg"></a>`Benchmark.forEach(array, callback, thisArg)`
463<a href="#benchmarkforeacharray-callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1518 "View in source") [Ⓣ][1]
464
465A generic `Array#forEach` like method. Callbacks may terminate the loop by explicitly returning `false`.
466
467#### Arguments
4681. `array` *(Array)*: The array to iterate over.
4692. `callback` *(Function)*: The function called per iteration.
4703. `thisArg` *(Mixed)*: The `this` binding for the callback.
471
472#### Returns
473*(Array)*: Returns the array iterated over.
474
475* * *
476
477<!-- /div -->
478
479
480<!-- div -->
481
482### <a id="benchmarkformatnumbernumber"></a>`Benchmark.formatNumber(number)`
483<a href="#benchmarkformatnumbernumber">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1557 "View in source") [Ⓣ][1]
484
485Converts a number to a more readable comma-separated string representation.
486
487#### Arguments
4881. `number` *(Number)*: The number to convert.
489
490#### Returns
491*(String)*: The more readable string representation.
492
493* * *
494
495<!-- /div -->
496
497
498<!-- div -->
499
500### <a id="benchmarkforownobject-callback-thisarg"></a>`Benchmark.forOwn(object, callback, thisArg)`
501<a href="#benchmarkforownobject-callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1545 "View in source") [Ⓣ][1]
502
503Iterates over an object's own properties, executing the `callback` for each. Callbacks may terminate the loop by explicitly returning `false`.
504
505#### Arguments
5061. `object` *(Object)*: The object to iterate over.
5072. `callback` *(Function)*: The function executed per own property.
5083. `thisArg` *(Mixed)*: The `this` binding for the callback.
509
510#### Returns
511*(Object)*: Returns the object iterated over.
512
513* * *
514
515<!-- /div -->
516
517
518<!-- div -->
519
520### <a id="benchmarkhaskeyobject-key"></a>`Benchmark.hasKey(object, key)`
521<a href="#benchmarkhaskeyobject-key">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1572 "View in source") [Ⓣ][1]
522
523Checks if an object has the specified key as a direct property.
524
525#### Arguments
5261. `object` *(Object)*: The object to check.
5272. `key` *(String)*: The key to check for.
528
529#### Returns
530*(Boolean)*: Returns `true` if key is a direct property, else `false`.
531
532* * *
533
534<!-- /div -->
535
536
537<!-- div -->
538
539### <a id="benchmarkindexofarray-value--fromindex0"></a>`Benchmark.indexOf(array, value [, fromIndex=0])`
540<a href="#benchmarkindexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1608 "View in source") [Ⓣ][1]
541
542A generic `Array#indexOf` like method.
543
544#### Arguments
5451. `array` *(Array)*: The array to iterate over.
5462. `value` *(Mixed)*: The value to search for.
5473. `[fromIndex=0]` *(Number)*: The index to start searching from.
548
549#### Returns
550*(Number)*: The index of the matched value or `-1`.
551
552* * *
553
554<!-- /div -->
555
556
557<!-- div -->
558
559### <a id="benchmarkinterpolatestring-object"></a>`Benchmark.interpolate(string, object)`
560<a href="#benchmarkinterpolatestring-object">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1630 "View in source") [Ⓣ][1]
561
562Modify a string by replacing named tokens with matching object property values.
563
564#### Arguments
5651. `string` *(String)*: The string to modify.
5662. `object` *(Object)*: The template object.
567
568#### Returns
569*(String)*: The modified string.
570
571* * *
572
573<!-- /div -->
574
575
576<!-- div -->
577
578### <a id="benchmarkinvokebenches-name--arg1-arg2-"></a>`Benchmark.invoke(benches, name [, arg1, arg2, ...])`
579<a href="#benchmarkinvokebenches-name--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1677 "View in source") [Ⓣ][1]
580
581Invokes a method on all items in an array.
582
583#### Arguments
5841. `benches` *(Array)*: Array of benchmarks to iterate over.
5852. `name` *(String|Object)*: The name of the method to invoke OR options object.
5863. `[arg1, arg2, ...]` *(Mixed)*: Arguments to invoke the method with.
587
588#### Returns
589*(Array)*: A new array of values returned from each method invoked.
590
591#### Example
592~~~ js
593// invoke `reset` on all benchmarks
594Benchmark.invoke(benches, 'reset');
595
596// invoke `emit` with arguments
597Benchmark.invoke(benches, 'emit', 'complete', listener);
598
599// invoke `run(true)`, treat benchmarks as a queue, and register invoke callbacks
600Benchmark.invoke(benches, {
601
602 // invoke the `run` method
603 'name': 'run',
604
605 // pass a single argument
606 'args': true,
607
608 // treat as queue, removing benchmarks from front of `benches` until empty
609 'queued': true,
610
611 // called before any benchmarks have been invoked.
612 'onStart': onStart,
613
614 // called between invoking benchmarks
615 'onCycle': onCycle,
616
617 // called after all benchmarks have been invoked.
618 'onComplete': onComplete
619});
620~~~
621
622* * *
623
624<!-- /div -->
625
626
627<!-- div -->
628
629### <a id="benchmarkjoinobject--separator1--separator2:"></a>`Benchmark.join(object [, separator1=',', separator2=': '])`
630<a href="#benchmarkjoinobject--separator1--separator2:">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1831 "View in source") [Ⓣ][1]
631
632Creates a string of joined array values or object key-value pairs.
633
634#### Arguments
6351. `object` *(Array|Object)*: The object to operate on.
6362. `[separator1=',']` *(String)*: The separator used between key-value pairs.
6373. `[separator2=': ']` *(String)*: The separator used between keys and values.
638
639#### Returns
640*(String)*: The joined result.
641
642* * *
643
644<!-- /div -->
645
646
647<!-- div -->
648
649### <a id="benchmarkmaparray-callback-thisarg"></a>`Benchmark.map(array, callback, thisArg)`
650<a href="#benchmarkmaparray-callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1853 "View in source") [Ⓣ][1]
651
652A generic `Array#map` like method.
653
654#### Arguments
6551. `array` *(Array)*: The array to iterate over.
6562. `callback` *(Function)*: The function called per iteration.
6573. `thisArg` *(Mixed)*: The `this` binding for the callback.
658
659#### Returns
660*(Array)*: A new array of values returned by the callback.
661
662* * *
663
664<!-- /div -->
665
666
667<!-- div -->
668
669### <a id="benchmarkpluckarray-property"></a>`Benchmark.pluck(array, property)`
670<a href="#benchmarkpluckarray-property">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1869 "View in source") [Ⓣ][1]
671
672Retrieves the value of a specified property from all items in an array.
673
674#### Arguments
6751. `array` *(Array)*: The array to iterate over.
6762. `property` *(String)*: The property to pluck.
677
678#### Returns
679*(Array)*: A new array of property values.
680
681* * *
682
683<!-- /div -->
684
685
686<!-- div -->
687
688### <a id="benchmarkreducearray-callback-accumulator"></a>`Benchmark.reduce(array, callback, accumulator)`
689<a href="#benchmarkreducearray-callback-accumulator">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1885 "View in source") [Ⓣ][1]
690
691A generic `Array#reduce` like method.
692
693#### Arguments
6941. `array` *(Array)*: The array to iterate over.
6952. `callback` *(Function)*: The function called per iteration.
6963. `accumulator` *(Mixed)*: Initial value of the accumulator.
697
698#### Returns
699*(Mixed)*: The accumulator.
700
701* * *
702
703<!-- /div -->
704
705
706<!-- /div -->
707
708
709<!-- div -->
710
711## `Benchmark.prototype`
712
713<!-- div -->
714
715### <a id="benchmarkprototypeaborted"></a>`Benchmark.prototype.aborted`
716<a href="#benchmarkprototypeaborted">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3377 "View in source") [Ⓣ][1]
717
718*(Boolean)*: A flag to indicate if the benchmark is aborted.
719
720* * *
721
722<!-- /div -->
723
724
725<!-- div -->
726
727### <a id="benchmarkprototypecompiled"></a>`Benchmark.prototype.compiled`
728<a href="#benchmarkprototypecompiled">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3353 "View in source") [Ⓣ][1]
729
730*(Function, String)*: The compiled test function.
731
732* * *
733
734<!-- /div -->
735
736
737<!-- div -->
738
739### <a id="benchmarkprototypecount"></a>`Benchmark.prototype.count`
740<a href="#benchmarkprototypecount">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3329 "View in source") [Ⓣ][1]
741
742*(Number)*: The number of times a test was executed.
743
744* * *
745
746<!-- /div -->
747
748
749<!-- div -->
750
751### <a id="benchmarkprototypecycles"></a>`Benchmark.prototype.cycles`
752<a href="#benchmarkprototypecycles">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3337 "View in source") [Ⓣ][1]
753
754*(Number)*: The number of cycles performed while benchmarking.
755
756* * *
757
758<!-- /div -->
759
760
761<!-- div -->
762
763### <a id="benchmarkprototypefn"></a>`Benchmark.prototype.fn`
764<a href="#benchmarkprototypefn">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3369 "View in source") [Ⓣ][1]
765
766*(Function, String)*: The test to benchmark.
767
768* * *
769
770<!-- /div -->
771
772
773<!-- div -->
774
775### <a id="benchmarkprototypehz"></a>`Benchmark.prototype.hz`
776<a href="#benchmarkprototypehz">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3345 "View in source") [Ⓣ][1]
777
778*(Number)*: The number of executions per second.
779
780* * *
781
782<!-- /div -->
783
784
785<!-- div -->
786
787### <a id="benchmarkprototyperunning"></a>`Benchmark.prototype.running`
788<a href="#benchmarkprototyperunning">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3385 "View in source") [Ⓣ][1]
789
790*(Boolean)*: A flag to indicate if the benchmark is running.
791
792* * *
793
794<!-- /div -->
795
796
797<!-- div -->
798
799### <a id="benchmarkprototypesetup"></a>`Benchmark.prototype.setup`
800<a href="#benchmarkprototypesetup">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3448 "View in source") [Ⓣ][1]
801
802*(Function, String)*: Compiled into the test and executed immediately **before** the test loop.
803
804#### Example
805~~~ js
806// basic usage
807var bench = Benchmark({
808 'setup': function() {
809 var c = this.count,
810 element = document.getElementById('container');
811 while (c--) {
812 element.appendChild(document.createElement('div'));
813 }
814 },
815 'fn': function() {
816 element.removeChild(element.lastChild);
817 }
818});
819
820// compiles to something like:
821var c = this.count,
822 element = document.getElementById('container');
823while (c--) {
824 element.appendChild(document.createElement('div'));
825}
826var start = new Date;
827while (count--) {
828 element.removeChild(element.lastChild);
829}
830var end = new Date - start;
831
832// or using strings
833var bench = Benchmark({
834 'setup': '\
835 var a = 0;\n\
836 (function() {\n\
837 (function() {\n\
838 (function() {',
839 'fn': 'a += 1;',
840 'teardown': '\
841 }())\n\
842 }())\n\
843 }())'
844});
845
846// compiles to something like:
847var a = 0;
848(function() {
849 (function() {
850 (function() {
851 var start = new Date;
852 while (count--) {
853 a += 1;
854 }
855 var end = new Date - start;
856 }())
857 }())
858}())
859~~~
860
861* * *
862
863<!-- /div -->
864
865
866<!-- div -->
867
868### <a id="benchmarkprototypeteardown"></a>`Benchmark.prototype.teardown`
869<a href="#benchmarkprototypeteardown">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3456 "View in source") [Ⓣ][1]
870
871*(Function, String)*: Compiled into the test and executed immediately **after** the test loop.
872
873* * *
874
875<!-- /div -->
876
877
878<!-- div -->
879
880### <a id="benchmarkprototypeabort"></a>`Benchmark.prototype.abort()`
881<a href="#benchmarkprototypeabort">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2218 "View in source") [Ⓣ][1]
882
883Aborts the benchmark without recording times.
884
885#### Returns
886*(Object)*: The benchmark instance.
887
888* * *
889
890<!-- /div -->
891
892
893<!-- div -->
894
895### <a id="benchmarkprototypecloneoptions"></a>`Benchmark.prototype.clone(options)`
896<a href="#benchmarkprototypecloneoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2257 "View in source") [Ⓣ][1]
897
898Creates a new benchmark using the same test and options.
899
900#### Arguments
9011. `options` *(Object)*: Options object to overwrite cloned options.
902
903#### Returns
904*(Object)*: The new benchmark instance.
905
906#### Example
907~~~ js
908var bizarro = bench.clone({
909 'name': 'doppelganger'
910});
911~~~
912
913* * *
914
915<!-- /div -->
916
917
918<!-- div -->
919
920### <a id="benchmarkprototypecompareother"></a>`Benchmark.prototype.compare(other)`
921<a href="#benchmarkprototypecompareother">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2280 "View in source") [Ⓣ][1]
922
923Determines if a benchmark is faster than another.
924
925#### Arguments
9261. `other` *(Object)*: The benchmark to compare.
927
928#### Returns
929*(Number)*: Returns `-1` if slower, `1` if faster, and `0` if indeterminate.
930
931* * *
932
933<!-- /div -->
934
935
936<!-- div -->
937
938### <a id="benchmarkprototypeemittype"></a>`Benchmark.Suite.prototype.emit(type)`
939<a href="#benchmarkprototypeemittype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2095 "View in source") [Ⓣ][1]
940
941Executes all registered listeners of the specified event type.
942
943#### Arguments
9441. `type` *(String|Object)*: The event type or object.
945
946#### Returns
947*(Mixed)*: Returns the return value of the last listener executed.
948
949* * *
950
951<!-- /div -->
952
953
954<!-- div -->
955
956### <a id="benchmarkprototypelistenerstype"></a>`Benchmark.Suite.prototype.listeners(type)`
957<a href="#benchmarkprototypelistenerstype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2125 "View in source") [Ⓣ][1]
958
959Returns an array of event listeners for a given type that can be manipulated to add or remove listeners.
960
961#### Arguments
9621. `type` *(String)*: The event type.
963
964#### Returns
965*(Array)*: The listeners array.
966
967* * *
968
969<!-- /div -->
970
971
972<!-- div -->
973
974### <a id="benchmarkprototypeofftype-listener"></a>`Benchmark.Suite.prototype.off([type, listener])`
975<a href="#benchmarkprototypeofftype-listener">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2158 "View in source") [Ⓣ][1]
976
977Unregisters a listener for the specified event type(s), or unregisters all listeners for the specified event type(s), or unregisters all listeners for all event types.
978
979#### Arguments
9801. `[type]` *(String)*: The event type.
9812. `[listener]` *(Function)*: The function to unregister.
982
983#### Returns
984*(Object)*: The benchmark instance.
985
986#### Example
987~~~ js
988// unregister a listener for an event type
989bench.off('cycle', listener);
990
991// unregister a listener for multiple event types
992bench.off('start cycle', listener);
993
994// unregister all listeners for an event type
995bench.off('cycle');
996
997// unregister all listeners for multiple event types
998bench.off('start cycle complete');
999
1000// unregister all listeners for all event types
1001bench.off();
1002~~~
1003
1004* * *
1005
1006<!-- /div -->
1007
1008
1009<!-- div -->
1010
1011### <a id="benchmarkprototypeontype-listener"></a>`Benchmark.Suite.prototype.on(type, listener)`
1012<a href="#benchmarkprototypeontype-listener">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2197 "View in source") [Ⓣ][1]
1013
1014Registers a listener for the specified event type(s).
1015
1016#### Arguments
10171. `type` *(String)*: The event type.
10182. `listener` *(Function)*: The function to register.
1019
1020#### Returns
1021*(Object)*: The benchmark instance.
1022
1023#### Example
1024~~~ js
1025// register a listener for an event type
1026bench.on('cycle', listener);
1027
1028// register a listener for multiple event types
1029bench.on('start cycle', listener);
1030~~~
1031
1032* * *
1033
1034<!-- /div -->
1035
1036
1037<!-- div -->
1038
1039### <a id="benchmarkprototypereset"></a>`Benchmark.prototype.reset()`
1040<a href="#benchmarkprototypereset">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2334 "View in source") [Ⓣ][1]
1041
1042Reset properties and abort if running.
1043
1044#### Returns
1045*(Object)*: The benchmark instance.
1046
1047* * *
1048
1049<!-- /div -->
1050
1051
1052<!-- div -->
1053
1054### <a id="benchmarkprototyperunoptions"></a>`Benchmark.prototype.run([options={}])`
1055<a href="#benchmarkprototyperunoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3000 "View in source") [Ⓣ][1]
1056
1057Runs the benchmark.
1058
1059#### Arguments
10601. `[options={}]` *(Object)*: Options object.
1061
1062#### Returns
1063*(Object)*: The benchmark instance.
1064
1065#### Example
1066~~~ js
1067// basic usage
1068bench.run();
1069
1070// or with options
1071bench.run({ 'async': true });
1072~~~
1073
1074* * *
1075
1076<!-- /div -->
1077
1078
1079<!-- div -->
1080
1081### <a id="benchmarkprototypetostring"></a>`Benchmark.prototype.toString()`
1082<a href="#benchmarkprototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2405 "View in source") [Ⓣ][1]
1083
1084Displays relevant benchmark information when coerced to a string.
1085
1086#### Returns
1087*(String)*: A string representation of the benchmark instance.
1088
1089* * *
1090
1091<!-- /div -->
1092
1093
1094<!-- /div -->
1095
1096
1097<!-- div -->
1098
1099## `Benchmark.options`
1100
1101<!-- div -->
1102
1103### <a id="benchmarkoptions"></a>`Benchmark.options`
1104<a href="#benchmarkoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3049 "View in source") [Ⓣ][1]
1105
1106*(Object)*: The default options copied by benchmark instances.
1107
1108* * *
1109
1110<!-- /div -->
1111
1112
1113<!-- div -->
1114
1115### <a id="benchmarkoptionsasync"></a>`Benchmark.options.async`
1116<a href="#benchmarkoptionsasync">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3058 "View in source") [Ⓣ][1]
1117
1118*(Boolean)*: A flag to indicate that benchmark cycles will execute asynchronously by default.
1119
1120* * *
1121
1122<!-- /div -->
1123
1124
1125<!-- div -->
1126
1127### <a id="benchmarkoptionsdefer"></a>`Benchmark.options.defer`
1128<a href="#benchmarkoptionsdefer">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3066 "View in source") [Ⓣ][1]
1129
1130*(Boolean)*: A flag to indicate that the benchmark clock is deferred.
1131
1132* * *
1133
1134<!-- /div -->
1135
1136
1137<!-- div -->
1138
1139### <a id="benchmarkoptionsdelay"></a>`Benchmark.options.delay`
1140<a href="#benchmarkoptionsdelay">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3073 "View in source") [Ⓣ][1]
1141
1142*(Number)*: The delay between test cycles *(secs)*.
1143
1144* * *
1145
1146<!-- /div -->
1147
1148
1149<!-- div -->
1150
1151### <a id="benchmarkoptionsid"></a>`Benchmark.options.id`
1152<a href="#benchmarkoptionsid">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3082 "View in source") [Ⓣ][1]
1153
1154*(String)*: Displayed by Benchmark#toString when a `name` is not available *(auto-generated if absent)*.
1155
1156* * *
1157
1158<!-- /div -->
1159
1160
1161<!-- div -->
1162
1163### <a id="benchmarkoptionsinitcount"></a>`Benchmark.options.initCount`
1164<a href="#benchmarkoptionsinitcount">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3090 "View in source") [Ⓣ][1]
1165
1166*(Number)*: The default number of times to execute a test on a benchmark's first cycle.
1167
1168* * *
1169
1170<!-- /div -->
1171
1172
1173<!-- div -->
1174
1175### <a id="benchmarkoptionsmaxtime"></a>`Benchmark.options.maxTime`
1176<a href="#benchmarkoptionsmaxtime">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3099 "View in source") [Ⓣ][1]
1177
1178*(Number)*: The maximum time a benchmark is allowed to run before finishing *(secs)*. Note: Cycle delays aren't counted toward the maximum time.
1179
1180* * *
1181
1182<!-- /div -->
1183
1184
1185<!-- div -->
1186
1187### <a id="benchmarkoptionsminsamples"></a>`Benchmark.options.minSamples`
1188<a href="#benchmarkoptionsminsamples">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3107 "View in source") [Ⓣ][1]
1189
1190*(Number)*: The minimum sample size required to perform statistical analysis.
1191
1192* * *
1193
1194<!-- /div -->
1195
1196
1197<!-- div -->
1198
1199### <a id="benchmarkoptionsmintime"></a>`Benchmark.options.minTime`
1200<a href="#benchmarkoptionsmintime">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3115 "View in source") [Ⓣ][1]
1201
1202*(Number)*: The time needed to reduce the percent uncertainty of measurement to `1`% *(secs)*.
1203
1204* * *
1205
1206<!-- /div -->
1207
1208
1209<!-- div -->
1210
1211### <a id="benchmarkoptionsname"></a>`Benchmark.options.name`
1212<a href="#benchmarkoptionsname">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3123 "View in source") [Ⓣ][1]
1213
1214*(String)*: The name of the benchmark.
1215
1216* * *
1217
1218<!-- /div -->
1219
1220
1221<!-- div -->
1222
1223### <a id="benchmarkoptionsonabort"></a>`Benchmark.options.onAbort`
1224<a href="#benchmarkoptionsonabort">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3131 "View in source") [Ⓣ][1]
1225
1226An event listener called when the benchmark is aborted.
1227
1228* * *
1229
1230<!-- /div -->
1231
1232
1233<!-- div -->
1234
1235### <a id="benchmarkoptionsoncomplete"></a>`Benchmark.options.onComplete`
1236<a href="#benchmarkoptionsoncomplete">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3139 "View in source") [Ⓣ][1]
1237
1238An event listener called when the benchmark completes running.
1239
1240* * *
1241
1242<!-- /div -->
1243
1244
1245<!-- div -->
1246
1247### <a id="benchmarkoptionsoncycle"></a>`Benchmark.options.onCycle`
1248<a href="#benchmarkoptionsoncycle">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3147 "View in source") [Ⓣ][1]
1249
1250An event listener called after each run cycle.
1251
1252* * *
1253
1254<!-- /div -->
1255
1256
1257<!-- div -->
1258
1259### <a id="benchmarkoptionsonerror"></a>`Benchmark.options.onError`
1260<a href="#benchmarkoptionsonerror">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3155 "View in source") [Ⓣ][1]
1261
1262An event listener called when a test errors.
1263
1264* * *
1265
1266<!-- /div -->
1267
1268
1269<!-- div -->
1270
1271### <a id="benchmarkoptionsonreset"></a>`Benchmark.options.onReset`
1272<a href="#benchmarkoptionsonreset">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3163 "View in source") [Ⓣ][1]
1273
1274An event listener called when the benchmark is reset.
1275
1276* * *
1277
1278<!-- /div -->
1279
1280
1281<!-- div -->
1282
1283### <a id="benchmarkoptionsonstart"></a>`Benchmark.options.onStart`
1284<a href="#benchmarkoptionsonstart">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3171 "View in source") [Ⓣ][1]
1285
1286An event listener called when the benchmark starts running.
1287
1288* * *
1289
1290<!-- /div -->
1291
1292
1293<!-- /div -->
1294
1295
1296<!-- div -->
1297
1298## `Benchmark.platform`
1299
1300<!-- div -->
1301
1302### <a id="benchmarkplatform"></a>`Benchmark.platform`
1303<a href="#benchmarkplatform">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3182 "View in source") [Ⓣ][1]
1304
1305*(Object)*: Platform object with properties describing things like browser name, version, and operating system.
1306
1307* * *
1308
1309<!-- /div -->
1310
1311
1312<!-- div -->
1313
1314### <a id="benchmarkplatformdescription"></a>`Benchmark.platform.description`
1315<a href="#benchmarkplatformdescription">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3190 "View in source") [Ⓣ][1]
1316
1317*(String)*: The platform description.
1318
1319* * *
1320
1321<!-- /div -->
1322
1323
1324<!-- div -->
1325
1326### <a id="benchmarkplatformlayout"></a>`Benchmark.platform.layout`
1327<a href="#benchmarkplatformlayout">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3198 "View in source") [Ⓣ][1]
1328
1329*(String, Null)*: The name of the browser layout engine.
1330
1331* * *
1332
1333<!-- /div -->
1334
1335
1336<!-- div -->
1337
1338### <a id="benchmarkplatformmanufacturer"></a>`Benchmark.platform.manufacturer`
1339<a href="#benchmarkplatformmanufacturer">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3222 "View in source") [Ⓣ][1]
1340
1341*(String, Null)*: The name of the product's manufacturer.
1342
1343* * *
1344
1345<!-- /div -->
1346
1347
1348<!-- div -->
1349
1350### <a id="benchmarkplatformname"></a>`Benchmark.platform.name`
1351<a href="#benchmarkplatformname">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3214 "View in source") [Ⓣ][1]
1352
1353*(String, Null)*: The name of the browser/environment.
1354
1355* * *
1356
1357<!-- /div -->
1358
1359
1360<!-- div -->
1361
1362### <a id="benchmarkplatformos"></a>`Benchmark.platform.os`
1363<a href="#benchmarkplatformos">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3230 "View in source") [Ⓣ][1]
1364
1365*(String, Null)*: The name of the operating system.
1366
1367* * *
1368
1369<!-- /div -->
1370
1371
1372<!-- div -->
1373
1374### <a id="benchmarkplatformprerelease"></a>`Benchmark.platform.prerelease`
1375<a href="#benchmarkplatformprerelease">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3238 "View in source") [Ⓣ][1]
1376
1377*(String, Null)*: The alpha/beta release indicator.
1378
1379* * *
1380
1381<!-- /div -->
1382
1383
1384<!-- div -->
1385
1386### <a id="benchmarkplatformproduct"></a>`Benchmark.platform.product`
1387<a href="#benchmarkplatformproduct">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3206 "View in source") [Ⓣ][1]
1388
1389*(String, Null)*: The name of the product hosting the browser.
1390
1391* * *
1392
1393<!-- /div -->
1394
1395
1396<!-- div -->
1397
1398### <a id="benchmarkplatformversion"></a>`Benchmark.platform.version`
1399<a href="#benchmarkplatformversion">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3246 "View in source") [Ⓣ][1]
1400
1401*(String, Null)*: The browser/environment version.
1402
1403* * *
1404
1405<!-- /div -->
1406
1407
1408<!-- div -->
1409
1410### <a id="benchmarkplatformtostring"></a>`Benchmark.platform.toString()`
1411<a href="#benchmarkplatformtostring">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3255 "View in source") [Ⓣ][1]
1412
1413Return platform description when the platform object is coerced to a string.
1414
1415#### Returns
1416*(String)*: The platform description.
1417
1418* * *
1419
1420<!-- /div -->
1421
1422
1423<!-- /div -->
1424
1425
1426<!-- div -->
1427
1428## `Benchmark.support`
1429
1430<!-- div -->
1431
1432### <a id="benchmarksupport"></a>`Benchmark.support`
1433<a href="#benchmarksupport">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L135 "View in source") [Ⓣ][1]
1434
1435*(Object)*: An object used to flag environments/features.
1436
1437* * *
1438
1439<!-- /div -->
1440
1441
1442<!-- div -->
1443
1444### <a id="benchmarksupportair"></a>`Benchmark.support.air`
1445<a href="#benchmarksupportair">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L145 "View in source") [Ⓣ][1]
1446
1447*(Boolean)*: Detect Adobe AIR.
1448
1449* * *
1450
1451<!-- /div -->
1452
1453
1454<!-- div -->
1455
1456### <a id="benchmarksupportargumentsclass"></a>`Benchmark.support.argumentsClass`
1457<a href="#benchmarksupportargumentsclass">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L153 "View in source") [Ⓣ][1]
1458
1459*(Boolean)*: Detect if `arguments` objects have the correct internal [[Class]] value.
1460
1461* * *
1462
1463<!-- /div -->
1464
1465
1466<!-- div -->
1467
1468### <a id="benchmarksupportbrowser"></a>`Benchmark.support.browser`
1469<a href="#benchmarksupportbrowser">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L161 "View in source") [Ⓣ][1]
1470
1471*(Boolean)*: Detect if in a browser environment.
1472
1473* * *
1474
1475<!-- /div -->
1476
1477
1478<!-- div -->
1479
1480### <a id="benchmarksupportcharbyindex"></a>`Benchmark.support.charByIndex`
1481<a href="#benchmarksupportcharbyindex">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L169 "View in source") [Ⓣ][1]
1482
1483*(Boolean)*: Detect if strings support accessing characters by index.
1484
1485* * *
1486
1487<!-- /div -->
1488
1489
1490<!-- div -->
1491
1492### <a id="benchmarksupportcharbyownindex"></a>`Benchmark.support.charByOwnIndex`
1493<a href="#benchmarksupportcharbyownindex">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L179 "View in source") [Ⓣ][1]
1494
1495*(Boolean)*: Detect if strings have indexes as own properties.
1496
1497* * *
1498
1499<!-- /div -->
1500
1501
1502<!-- div -->
1503
1504### <a id="benchmarksupportdecompilation"></a>`Benchmark.support.decompilation`
1505<a href="#benchmarksupportdecompilation">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L207 "View in source") [Ⓣ][1]
1506
1507*(Boolean)*: Detect if functions support decompilation.
1508
1509* * *
1510
1511<!-- /div -->
1512
1513
1514<!-- div -->
1515
1516### <a id="benchmarksupportdescriptors"></a>`Benchmark.support.descriptors`
1517<a href="#benchmarksupportdescriptors">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L228 "View in source") [Ⓣ][1]
1518
1519*(Boolean)*: Detect ES5+ property descriptor API.
1520
1521* * *
1522
1523<!-- /div -->
1524
1525
1526<!-- div -->
1527
1528### <a id="benchmarksupportgetallkeys"></a>`Benchmark.support.getAllKeys`
1529<a href="#benchmarksupportgetallkeys">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L242 "View in source") [Ⓣ][1]
1530
1531*(Boolean)*: Detect ES5+ Object.getOwnPropertyNames().
1532
1533* * *
1534
1535<!-- /div -->
1536
1537
1538<!-- div -->
1539
1540### <a id="benchmarksupportiteratesownfirst"></a>`Benchmark.support.iteratesOwnFirst`
1541<a href="#benchmarksupportiteratesownfirst">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L255 "View in source") [Ⓣ][1]
1542
1543*(Boolean)*: Detect if own properties are iterated before inherited properties *(all but IE < `9`)*.
1544
1545* * *
1546
1547<!-- /div -->
1548
1549
1550<!-- div -->
1551
1552### <a id="benchmarksupportjava"></a>`Benchmark.support.java`
1553<a href="#benchmarksupportjava">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L190 "View in source") [Ⓣ][1]
1554
1555*(Boolean)*: Detect if Java is enabled/exposed.
1556
1557* * *
1558
1559<!-- /div -->
1560
1561
1562<!-- div -->
1563
1564### <a id="benchmarksupportnodeclass"></a>`Benchmark.support.nodeClass`
1565<a href="#benchmarksupportnodeclass">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L272 "View in source") [Ⓣ][1]
1566
1567*(Boolean)*: Detect if a node's [[Class]] is resolvable *(all but IE < `9`)* and that the JS engine errors when attempting to coerce an object to a string without a `toString` property value of `typeof` "function".
1568
1569* * *
1570
1571<!-- /div -->
1572
1573
1574<!-- div -->
1575
1576### <a id="benchmarksupporttimeout"></a>`Benchmark.support.timeout`
1577<a href="#benchmarksupporttimeout">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L198 "View in source") [Ⓣ][1]
1578
1579*(Boolean)*: Detect if the Timers API exists.
1580
1581* * *
1582
1583<!-- /div -->
1584
1585
1586<!-- /div -->
1587
1588
1589<!-- div -->
1590
1591## `Benchmark.prototype.error`
1592
1593<!-- div -->
1594
1595### <a id="benchmarkprototypeerror"></a>`Benchmark.prototype.error`
1596<a href="#benchmarkprototypeerror">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3361 "View in source") [Ⓣ][1]
1597
1598*(Object)*: The error object if the test failed.
1599
1600* * *
1601
1602<!-- /div -->
1603
1604
1605<!-- /div -->
1606
1607
1608<!-- div -->
1609
1610## `Benchmark.prototype.stats`
1611
1612<!-- div -->
1613
1614### <a id="benchmarkprototypestats"></a>`Benchmark.prototype.stats`
1615<a href="#benchmarkprototypestats">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3464 "View in source") [Ⓣ][1]
1616
1617*(Object)*: An object of stats including mean, margin or error, and standard deviation.
1618
1619* * *
1620
1621<!-- /div -->
1622
1623
1624<!-- div -->
1625
1626### <a id="benchmark-statsdeviation"></a>`Benchmark.prototype.stats.deviation`
1627<a href="#benchmark-statsdeviation">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3496 "View in source") [Ⓣ][1]
1628
1629*(Number)*: The sample standard deviation.
1630
1631* * *
1632
1633<!-- /div -->
1634
1635
1636<!-- div -->
1637
1638### <a id="benchmark-statsmean"></a>`Benchmark.prototype.stats.mean`
1639<a href="#benchmark-statsmean">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3504 "View in source") [Ⓣ][1]
1640
1641*(Number)*: The sample arithmetic mean.
1642
1643* * *
1644
1645<!-- /div -->
1646
1647
1648<!-- div -->
1649
1650### <a id="benchmark-statsmoe"></a>`Benchmark.prototype.stats.moe`
1651<a href="#benchmark-statsmoe">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3472 "View in source") [Ⓣ][1]
1652
1653*(Number)*: The margin of error.
1654
1655* * *
1656
1657<!-- /div -->
1658
1659
1660<!-- div -->
1661
1662### <a id="benchmark-statsrme"></a>`Benchmark.prototype.stats.rme`
1663<a href="#benchmark-statsrme">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3480 "View in source") [Ⓣ][1]
1664
1665*(Number)*: The relative margin of error *(expressed as a percentage of the mean)*.
1666
1667* * *
1668
1669<!-- /div -->
1670
1671
1672<!-- div -->
1673
1674### <a id="benchmark-statssample"></a>`Benchmark.prototype.stats.sample`
1675<a href="#benchmark-statssample">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3512 "View in source") [Ⓣ][1]
1676
1677*(Array)*: The array of sampled periods.
1678
1679* * *
1680
1681<!-- /div -->
1682
1683
1684<!-- div -->
1685
1686### <a id="benchmark-statssem"></a>`Benchmark.prototype.stats.sem`
1687<a href="#benchmark-statssem">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3488 "View in source") [Ⓣ][1]
1688
1689*(Number)*: The standard error of the mean.
1690
1691* * *
1692
1693<!-- /div -->
1694
1695
1696<!-- div -->
1697
1698### <a id="benchmark-statsvariance"></a>`Benchmark.prototype.stats.variance`
1699<a href="#benchmark-statsvariance">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3520 "View in source") [Ⓣ][1]
1700
1701*(Number)*: The sample variance.
1702
1703* * *
1704
1705<!-- /div -->
1706
1707
1708<!-- /div -->
1709
1710
1711<!-- div -->
1712
1713## `Benchmark.prototype.times`
1714
1715<!-- div -->
1716
1717### <a id="benchmarkprototypetimes"></a>`Benchmark.prototype.times`
1718<a href="#benchmarkprototypetimes">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3529 "View in source") [Ⓣ][1]
1719
1720*(Object)*: An object of timing data including cycle, elapsed, period, start, and stop.
1721
1722* * *
1723
1724<!-- /div -->
1725
1726
1727<!-- div -->
1728
1729### <a id="benchmark-timescycle"></a>`Benchmark.prototype.times.cycle`
1730<a href="#benchmark-timescycle">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3537 "View in source") [Ⓣ][1]
1731
1732*(Number)*: The time taken to complete the last cycle *(secs)*.
1733
1734* * *
1735
1736<!-- /div -->
1737
1738
1739<!-- div -->
1740
1741### <a id="benchmark-timeselapsed"></a>`Benchmark.prototype.times.elapsed`
1742<a href="#benchmark-timeselapsed">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3545 "View in source") [Ⓣ][1]
1743
1744*(Number)*: The time taken to complete the benchmark *(secs)*.
1745
1746* * *
1747
1748<!-- /div -->
1749
1750
1751<!-- div -->
1752
1753### <a id="benchmark-timesperiod"></a>`Benchmark.prototype.times.period`
1754<a href="#benchmark-timesperiod">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3553 "View in source") [Ⓣ][1]
1755
1756*(Number)*: The time taken to execute the test once *(secs)*.
1757
1758* * *
1759
1760<!-- /div -->
1761
1762
1763<!-- div -->
1764
1765### <a id="benchmark-timestimestamp"></a>`Benchmark.prototype.times.timeStamp`
1766<a href="#benchmark-timestimestamp">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3561 "View in source") [Ⓣ][1]
1767
1768*(Number)*: A timestamp of when the benchmark started *(ms)*.
1769
1770* * *
1771
1772<!-- /div -->
1773
1774
1775<!-- /div -->
1776
1777
1778<!-- div -->
1779
1780## `Benchmark.Deferred`
1781
1782<!-- div -->
1783
1784### <a id="benchmarkdeferredclone"></a>`Benchmark.Deferred(clone)`
1785<a href="#benchmarkdeferredclone">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L445 "View in source") [Ⓣ][1]
1786
1787The Deferred constructor.
1788
1789#### Arguments
17901. `clone` *(Object)*: The cloned benchmark instance.
1791
1792* * *
1793
1794<!-- /div -->
1795
1796
1797<!-- /div -->
1798
1799
1800<!-- div -->
1801
1802## `Benchmark.Deferred.prototype`
1803
1804<!-- div -->
1805
1806### <a id="benchmarkdeferredprototypebenchmark"></a>`Benchmark.Deferred.prototype.benchmark`
1807<a href="#benchmarkdeferredprototypebenchmark">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3605 "View in source") [Ⓣ][1]
1808
1809*(Object)*: The deferred benchmark instance.
1810
1811* * *
1812
1813<!-- /div -->
1814
1815
1816<!-- div -->
1817
1818### <a id="benchmarkdeferredprototypecycles"></a>`Benchmark.Deferred.prototype.cycles`
1819<a href="#benchmarkdeferredprototypecycles">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3613 "View in source") [Ⓣ][1]
1820
1821*(Number)*: The number of deferred cycles performed while benchmarking.
1822
1823* * *
1824
1825<!-- /div -->
1826
1827
1828<!-- div -->
1829
1830### <a id="benchmarkdeferredprototypeelapsed"></a>`Benchmark.Deferred.prototype.elapsed`
1831<a href="#benchmarkdeferredprototypeelapsed">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3621 "View in source") [Ⓣ][1]
1832
1833*(Number)*: The time taken to complete the deferred benchmark *(secs)*.
1834
1835* * *
1836
1837<!-- /div -->
1838
1839
1840<!-- div -->
1841
1842### <a id="benchmarkdeferredprototyperesolve"></a>`Benchmark.Deferred.prototype.resolve`
1843<a href="#benchmarkdeferredprototyperesolve">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1188 "View in source") [Ⓣ][1]
1844
1845*(Unknown)*: Handles cycling/completing the deferred benchmark.
1846
1847* * *
1848
1849<!-- /div -->
1850
1851
1852<!-- div -->
1853
1854### <a id="benchmarkdeferredprototypetimestamp"></a>`Benchmark.Deferred.prototype.timeStamp`
1855<a href="#benchmarkdeferredprototypetimestamp">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3629 "View in source") [Ⓣ][1]
1856
1857*(Number)*: A timestamp of when the deferred benchmark started *(ms)*.
1858
1859* * *
1860
1861<!-- /div -->
1862
1863
1864<!-- /div -->
1865
1866
1867<!-- div -->
1868
1869## `Benchmark.Event`
1870
1871<!-- div -->
1872
1873### <a id="benchmarkeventtype"></a>`Benchmark.Event(type)`
1874<a href="#benchmarkeventtype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L461 "View in source") [Ⓣ][1]
1875
1876The Event constructor.
1877
1878#### Arguments
18791. `type` *(String|Object)*: The event type.
1880
1881* * *
1882
1883<!-- /div -->
1884
1885
1886<!-- /div -->
1887
1888
1889<!-- div -->
1890
1891## `Benchmark.Event.prototype`
1892
1893<!-- div -->
1894
1895### <a id="benchmarkeventprototypeaborted"></a>`Benchmark.Event.prototype.aborted`
1896<a href="#benchmarkeventprototypeaborted">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3645 "View in source") [Ⓣ][1]
1897
1898*(Boolean)*: A flag to indicate if the emitters listener iteration is aborted.
1899
1900* * *
1901
1902<!-- /div -->
1903
1904
1905<!-- div -->
1906
1907### <a id="benchmarkeventprototypecancelled"></a>`Benchmark.Event.prototype.cancelled`
1908<a href="#benchmarkeventprototypecancelled">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3653 "View in source") [Ⓣ][1]
1909
1910*(Boolean)*: A flag to indicate if the default action is cancelled.
1911
1912* * *
1913
1914<!-- /div -->
1915
1916
1917<!-- div -->
1918
1919### <a id="benchmarkeventprototyperesult"></a>`Benchmark.Event.prototype.result`
1920<a href="#benchmarkeventprototyperesult">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3669 "View in source") [Ⓣ][1]
1921
1922*(Mixed)*: The return value of the last executed listener.
1923
1924* * *
1925
1926<!-- /div -->
1927
1928
1929<!-- div -->
1930
1931### <a id="benchmarkeventprototypetimestamp"></a>`Benchmark.Event.prototype.timeStamp`
1932<a href="#benchmarkeventprototypetimestamp">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3685 "View in source") [Ⓣ][1]
1933
1934*(Number)*: A timestamp of when the event was created *(ms)*.
1935
1936* * *
1937
1938<!-- /div -->
1939
1940
1941<!-- div -->
1942
1943### <a id="benchmarkeventprototypetype"></a>`Benchmark.Event.prototype.type`
1944<a href="#benchmarkeventprototypetype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3693 "View in source") [Ⓣ][1]
1945
1946*(String)*: The event type.
1947
1948* * *
1949
1950<!-- /div -->
1951
1952
1953<!-- /div -->
1954
1955
1956<!-- div -->
1957
1958## `Benchmark.Event.prototype.currentTarget`
1959
1960<!-- div -->
1961
1962### <a id="benchmarkeventprototypecurrenttarget"></a>`Benchmark.Event.prototype.currentTarget`
1963<a href="#benchmarkeventprototypecurrenttarget">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3661 "View in source") [Ⓣ][1]
1964
1965*(Object)*: The object whose listeners are currently being processed.
1966
1967* * *
1968
1969<!-- /div -->
1970
1971
1972<!-- /div -->
1973
1974
1975<!-- div -->
1976
1977## `Benchmark.Event.prototype.target`
1978
1979<!-- div -->
1980
1981### <a id="benchmarkeventprototypetarget"></a>`Benchmark.Event.prototype.target`
1982<a href="#benchmarkeventprototypetarget">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3677 "View in source") [Ⓣ][1]
1983
1984*(Object)*: The object to which the event was originally emitted.
1985
1986* * *
1987
1988<!-- /div -->
1989
1990
1991<!-- /div -->
1992
1993
1994<!-- div -->
1995
1996## `Benchmark.Suite`
1997
1998<!-- div -->
1999
2000### <a id="benchmarksuitename--options"></a>`Benchmark.Suite(name [, options={}])`
2001<a href="#benchmarksuitename--options">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L507 "View in source") [Ⓣ][1]
2002
2003The Suite constructor.
2004
2005#### Arguments
20061. `name` *(String)*: A name to identify the suite.
20072. `[options={}]` *(Object)*: Options object.
2008
2009#### Example
2010~~~ js
2011// basic usage (the `new` operator is optional)
2012var suite = new Benchmark.Suite;
2013
2014// or using a name first
2015var suite = new Benchmark.Suite('foo');
2016
2017// or with options
2018var suite = new Benchmark.Suite('foo', {
2019
2020 // called when the suite starts running
2021 'onStart': onStart,
2022
2023 // called between running benchmarks
2024 'onCycle': onCycle,
2025
2026 // called when aborted
2027 'onAbort': onAbort,
2028
2029 // called when a test errors
2030 'onError': onError,
2031
2032 // called when reset
2033 'onReset': onReset,
2034
2035 // called when the suite completes running
2036 'onComplete': onComplete
2037});
2038~~~
2039
2040* * *
2041
2042<!-- /div -->
2043
2044
2045<!-- /div -->
2046
2047
2048<!-- div -->
2049
2050## `Benchmark.Suite.prototype`
2051
2052<!-- div -->
2053
2054### <a id="benchmarksuiteprototypeaborted"></a>`Benchmark.Suite.prototype.aborted`
2055<a href="#benchmarksuiteprototypeaborted">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3734 "View in source") [Ⓣ][1]
2056
2057*(Boolean)*: A flag to indicate if the suite is aborted.
2058
2059* * *
2060
2061<!-- /div -->
2062
2063
2064<!-- div -->
2065
2066### <a id="benchmarksuiteprototypelength"></a>`Benchmark.Suite.prototype.length`
2067<a href="#benchmarksuiteprototypelength">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3726 "View in source") [Ⓣ][1]
2068
2069*(Number)*: The number of benchmarks in the suite.
2070
2071* * *
2072
2073<!-- /div -->
2074
2075
2076<!-- div -->
2077
2078### <a id="benchmarksuiteprototyperunning"></a>`Benchmark.Suite.prototype.running`
2079<a href="#benchmarksuiteprototyperunning">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3742 "View in source") [Ⓣ][1]
2080
2081*(Boolean)*: A flag to indicate if the suite is running.
2082
2083* * *
2084
2085<!-- /div -->
2086
2087
2088<!-- div -->
2089
2090### <a id="benchmarksuiteprototypeabort"></a>`Benchmark.Suite.prototype.abort()`
2091<a href="#benchmarksuiteprototypeabort">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1902 "View in source") [Ⓣ][1]
2092
2093Aborts all benchmarks in the suite.
2094
2095#### Returns
2096*(Object)*: The suite instance.
2097
2098* * *
2099
2100<!-- /div -->
2101
2102
2103<!-- div -->
2104
2105### <a id="benchmarksuiteprototypeaddname-fn--options"></a>`Benchmark.Suite.prototype.add(name, fn [, options={}])`
2106<a href="#benchmarksuiteprototypeaddname-fn--options">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1962 "View in source") [Ⓣ][1]
2107
2108Adds a test to the benchmark suite.
2109
2110#### Arguments
21111. `name` *(String)*: A name to identify the benchmark.
21122. `fn` *(Function|String)*: The test to benchmark.
21133. `[options={}]` *(Object)*: Options object.
2114
2115#### Returns
2116*(Object)*: The benchmark instance.
2117
2118#### Example
2119~~~ js
2120// basic usage
2121suite.add(fn);
2122
2123// or using a name first
2124suite.add('foo', fn);
2125
2126// or with options
2127suite.add('foo', fn, {
2128 'onCycle': onCycle,
2129 'onComplete': onComplete
2130});
2131
2132// or name and options
2133suite.add('foo', {
2134 'fn': fn,
2135 'onCycle': onCycle,
2136 'onComplete': onComplete
2137});
2138
2139// or options only
2140suite.add({
2141 'name': 'foo',
2142 'fn': fn,
2143 'onCycle': onCycle,
2144 'onComplete': onComplete
2145});
2146~~~
2147
2148* * *
2149
2150<!-- /div -->
2151
2152
2153<!-- div -->
2154
2155### <a id="benchmarksuiteprototypecloneoptions"></a>`Benchmark.Suite.prototype.clone(options)`
2156<a href="#benchmarksuiteprototypecloneoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L1981 "View in source") [Ⓣ][1]
2157
2158Creates a new suite with cloned benchmarks.
2159
2160#### Arguments
21611. `options` *(Object)*: Options object to overwrite cloned options.
2162
2163#### Returns
2164*(Object)*: The new suite instance.
2165
2166* * *
2167
2168<!-- /div -->
2169
2170
2171<!-- div -->
2172
2173### <a id="benchmarkprototypeemittype"></a>`Benchmark.Suite.prototype.emit(type)`
2174<a href="#benchmarkprototypeemittype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2095 "View in source") [Ⓣ][1]
2175
2176Executes all registered listeners of the specified event type.
2177
2178#### Arguments
21791. `type` *(String|Object)*: The event type or object.
2180
2181#### Returns
2182*(Mixed)*: Returns the return value of the last listener executed.
2183
2184* * *
2185
2186<!-- /div -->
2187
2188
2189<!-- div -->
2190
2191### <a id="benchmarksuiteprototypefiltercallback"></a>`Benchmark.Suite.prototype.filter(callback)`
2192<a href="#benchmarksuiteprototypefiltercallback">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2004 "View in source") [Ⓣ][1]
2193
2194An `Array#filter` like method.
2195
2196#### Arguments
21971. `callback` *(Function|String)*: The function/alias called per iteration.
2198
2199#### Returns
2200*(Object)*: A new suite of benchmarks that passed callback filter.
2201
2202* * *
2203
2204<!-- /div -->
2205
2206
2207<!-- div -->
2208
2209### <a id="benchmarksuiteprototypeforeachcallback"></a>`Benchmark.Suite.prototype.forEach(callback)`
2210<a href="#benchmarksuiteprototypeforeachcallback">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3752 "View in source") [Ⓣ][1]
2211
2212An `Array#forEach` like method. Callbacks may terminate the loop by explicitly returning `false`.
2213
2214#### Arguments
22151. `callback` *(Function)*: The function called per iteration.
2216
2217#### Returns
2218*(Object)*: The suite iterated over.
2219
2220* * *
2221
2222<!-- /div -->
2223
2224
2225<!-- div -->
2226
2227### <a id="benchmarksuiteprototypeindexofvalue"></a>`Benchmark.Suite.prototype.indexOf(value)`
2228<a href="#benchmarksuiteprototypeindexofvalue">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3761 "View in source") [Ⓣ][1]
2229
2230An `Array#indexOf` like method.
2231
2232#### Arguments
22331. `value` *(Mixed)*: The value to search for.
2234
2235#### Returns
2236*(Number)*: The index of the matched value or `-1`.
2237
2238* * *
2239
2240<!-- /div -->
2241
2242
2243<!-- div -->
2244
2245### <a id="benchmarksuiteprototypeinvokename--arg1-arg2-"></a>`Benchmark.Suite.prototype.invoke(name [, arg1, arg2, ...])`
2246<a href="#benchmarksuiteprototypeinvokename--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3771 "View in source") [Ⓣ][1]
2247
2248Invokes a method on all benchmarks in the suite.
2249
2250#### Arguments
22511. `name` *(String|Object)*: The name of the method to invoke OR options object.
22522. `[arg1, arg2, ...]` *(Mixed)*: Arguments to invoke the method with.
2253
2254#### Returns
2255*(Array)*: A new array of values returned from each method invoked.
2256
2257* * *
2258
2259<!-- /div -->
2260
2261
2262<!-- div -->
2263
2264### <a id="benchmarksuiteprototypejoinseparator-"></a>`Benchmark.Suite.prototype.join([separator=','])`
2265<a href="#benchmarksuiteprototypejoinseparator-">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3780 "View in source") [Ⓣ][1]
2266
2267Converts the suite of benchmarks to a string.
2268
2269#### Arguments
22701. `[separator=',']` *(String)*: A string to separate each element of the array.
2271
2272#### Returns
2273*(String)*: The string.
2274
2275* * *
2276
2277<!-- /div -->
2278
2279
2280<!-- div -->
2281
2282### <a id="benchmarkprototypelistenerstype"></a>`Benchmark.Suite.prototype.listeners(type)`
2283<a href="#benchmarkprototypelistenerstype">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2125 "View in source") [Ⓣ][1]
2284
2285Returns an array of event listeners for a given type that can be manipulated to add or remove listeners.
2286
2287#### Arguments
22881. `type` *(String)*: The event type.
2289
2290#### Returns
2291*(Array)*: The listeners array.
2292
2293* * *
2294
2295<!-- /div -->
2296
2297
2298<!-- div -->
2299
2300### <a id="benchmarksuiteprototypemapcallback"></a>`Benchmark.Suite.prototype.map(callback)`
2301<a href="#benchmarksuiteprototypemapcallback">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3789 "View in source") [Ⓣ][1]
2302
2303An `Array#map` like method.
2304
2305#### Arguments
23061. `callback` *(Function)*: The function called per iteration.
2307
2308#### Returns
2309*(Array)*: A new array of values returned by the callback.
2310
2311* * *
2312
2313<!-- /div -->
2314
2315
2316<!-- div -->
2317
2318### <a id="benchmarkprototypeofftype-listener"></a>`Benchmark.Suite.prototype.off([type, listener])`
2319<a href="#benchmarkprototypeofftype-listener">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2158 "View in source") [Ⓣ][1]
2320
2321Unregisters a listener for the specified event type(s), or unregisters all listeners for the specified event type(s), or unregisters all listeners for all event types.
2322
2323#### Arguments
23241. `[type]` *(String)*: The event type.
23252. `[listener]` *(Function)*: The function to unregister.
2326
2327#### Returns
2328*(Object)*: The benchmark instance.
2329
2330#### Example
2331~~~ js
2332// unregister a listener for an event type
2333bench.off('cycle', listener);
2334
2335// unregister a listener for multiple event types
2336bench.off('start cycle', listener);
2337
2338// unregister all listeners for an event type
2339bench.off('cycle');
2340
2341// unregister all listeners for multiple event types
2342bench.off('start cycle complete');
2343
2344// unregister all listeners for all event types
2345bench.off();
2346~~~
2347
2348* * *
2349
2350<!-- /div -->
2351
2352
2353<!-- div -->
2354
2355### <a id="benchmarkprototypeontype-listener"></a>`Benchmark.Suite.prototype.on(type, listener)`
2356<a href="#benchmarkprototypeontype-listener">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2197 "View in source") [Ⓣ][1]
2357
2358Registers a listener for the specified event type(s).
2359
2360#### Arguments
23611. `type` *(String)*: The event type.
23622. `listener` *(Function)*: The function to register.
2363
2364#### Returns
2365*(Object)*: The benchmark instance.
2366
2367#### Example
2368~~~ js
2369// register a listener for an event type
2370bench.on('cycle', listener);
2371
2372// register a listener for multiple event types
2373bench.on('start cycle', listener);
2374~~~
2375
2376* * *
2377
2378<!-- /div -->
2379
2380
2381<!-- div -->
2382
2383### <a id="benchmarksuiteprototypepluckproperty"></a>`Benchmark.Suite.prototype.pluck(property)`
2384<a href="#benchmarksuiteprototypepluckproperty">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3798 "View in source") [Ⓣ][1]
2385
2386Retrieves the value of a specified property from all benchmarks in the suite.
2387
2388#### Arguments
23891. `property` *(String)*: The property to pluck.
2390
2391#### Returns
2392*(Array)*: A new array of property values.
2393
2394* * *
2395
2396<!-- /div -->
2397
2398
2399<!-- div -->
2400
2401### <a id="benchmarksuiteprototypepop"></a>`Benchmark.Suite.prototype.pop()`
2402<a href="#benchmarksuiteprototypepop">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3806 "View in source") [Ⓣ][1]
2403
2404Removes the last benchmark from the suite and returns it.
2405
2406#### Returns
2407*(Mixed)*: The removed benchmark.
2408
2409* * *
2410
2411<!-- /div -->
2412
2413
2414<!-- div -->
2415
2416### <a id="benchmarksuiteprototypepush"></a>`Benchmark.Suite.prototype.push()`
2417<a href="#benchmarksuiteprototypepush">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3814 "View in source") [Ⓣ][1]
2418
2419Appends benchmarks to the suite.
2420
2421#### Returns
2422*(Number)*: The suite's new length.
2423
2424* * *
2425
2426<!-- /div -->
2427
2428
2429<!-- div -->
2430
2431### <a id="benchmarksuiteprototypereducecallback-accumulator"></a>`Benchmark.Suite.prototype.reduce(callback, accumulator)`
2432<a href="#benchmarksuiteprototypereducecallback-accumulator">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3833 "View in source") [Ⓣ][1]
2433
2434An `Array#reduce` like method.
2435
2436#### Arguments
24371. `callback` *(Function)*: The function called per iteration.
24382. `accumulator` *(Mixed)*: Initial value of the accumulator.
2439
2440#### Returns
2441*(Mixed)*: The accumulator.
2442
2443* * *
2444
2445<!-- /div -->
2446
2447
2448<!-- div -->
2449
2450### <a id="benchmarksuiteprototypereset"></a>`Benchmark.Suite.prototype.reset()`
2451<a href="#benchmarksuiteprototypereset">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2019 "View in source") [Ⓣ][1]
2452
2453Resets all benchmarks in the suite.
2454
2455#### Returns
2456*(Object)*: The suite instance.
2457
2458* * *
2459
2460<!-- /div -->
2461
2462
2463<!-- div -->
2464
2465### <a id="benchmarksuiteprototypereverse"></a>`Benchmark.Suite.prototype.reverse()`
2466<a href="#benchmarksuiteprototypereverse">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L638 "View in source") [Ⓣ][1]
2467
2468Rearrange the host array's elements in reverse order.
2469
2470#### Returns
2471*(Array)*: The reversed array.
2472
2473* * *
2474
2475<!-- /div -->
2476
2477
2478<!-- div -->
2479
2480### <a id="benchmarksuiteprototyperunoptions"></a>`Benchmark.Suite.prototype.run([options={}])`
2481<a href="#benchmarksuiteprototyperunoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L2056 "View in source") [Ⓣ][1]
2482
2483Runs the suite.
2484
2485#### Arguments
24861. `[options={}]` *(Object)*: Options object.
2487
2488#### Returns
2489*(Object)*: The suite instance.
2490
2491#### Example
2492~~~ js
2493// basic usage
2494suite.run();
2495
2496// or with options
2497suite.run({ 'async': true, 'queued': true });
2498~~~
2499
2500* * *
2501
2502<!-- /div -->
2503
2504
2505<!-- div -->
2506
2507### <a id="benchmarksuiteprototypeshift"></a>`Benchmark.Suite.prototype.shift()`
2508<a href="#benchmarksuiteprototypeshift">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L671 "View in source") [Ⓣ][1]
2509
2510Removes the first element of the host array and returns it.
2511
2512#### Returns
2513*(Mixed)*: The first element of the array.
2514
2515* * *
2516
2517<!-- /div -->
2518
2519
2520<!-- div -->
2521
2522### <a id="benchmarksuiteprototypeslicestart-end"></a>`Benchmark.Suite.prototype.slice(start, end)`
2523<a href="#benchmarksuiteprototypeslicestart-end">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L684 "View in source") [Ⓣ][1]
2524
2525Creates an array of the host array's elements from the start index up to, but not including, the end index.
2526
2527#### Arguments
25281. `start` *(Number)*: The starting index.
25292. `end` *(Number)*: The end index.
2530
2531#### Returns
2532*(Array)*: The new array.
2533
2534* * *
2535
2536<!-- /div -->
2537
2538
2539<!-- div -->
2540
2541### <a id="benchmarksuiteprototypesortcomparefnnull"></a>`Benchmark.Suite.prototype.sort([compareFn=null])`
2542<a href="#benchmarksuiteprototypesortcomparefnnull">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3823 "View in source") [Ⓣ][1]
2543
2544Sorts the benchmarks of the suite.
2545
2546#### Arguments
25471. `[compareFn=null]` *(Function)*: A function that defines the sort order.
2548
2549#### Returns
2550*(Object)*: The sorted suite.
2551
2552* * *
2553
2554<!-- /div -->
2555
2556
2557<!-- div -->
2558
2559### <a id="benchmarksuiteprototypesplicestart-deletecount--val1-val2-"></a>`Benchmark.Suite.prototype.splice(start, deleteCount [, val1, val2, ...])`
2560<a href="#benchmarksuiteprototypesplicestart-deletecount--val1-val2-">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L714 "View in source") [Ⓣ][1]
2561
2562Allows removing a range of elements and/or inserting elements into the host array.
2563
2564#### Arguments
25651. `start` *(Number)*: The start index.
25662. `deleteCount` *(Number)*: The number of elements to delete.
25673. `[val1, val2, ...]` *(Mixed)*: values to insert at the `start` index.
2568
2569#### Returns
2570*(Array)*: An array of removed elements.
2571
2572* * *
2573
2574<!-- /div -->
2575
2576
2577<!-- div -->
2578
2579### <a id="benchmarksuiteprototypeunshift"></a>`Benchmark.Suite.prototype.unshift()`
2580<a href="#benchmarksuiteprototypeunshift">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L749 "View in source") [Ⓣ][1]
2581
2582Appends arguments to the host array.
2583
2584#### Returns
2585*(Number)*: The new length.
2586
2587* * *
2588
2589<!-- /div -->
2590
2591
2592<!-- /div -->
2593
2594
2595<!-- div -->
2596
2597## `Benchmark.Suite.options`
2598
2599<!-- div -->
2600
2601### <a id="benchmarksuiteoptions"></a>`Benchmark.Suite.options`
2602<a href="#benchmarksuiteoptions">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3705 "View in source") [Ⓣ][1]
2603
2604*(Object)*: The default options copied by suite instances.
2605
2606* * *
2607
2608<!-- /div -->
2609
2610
2611<!-- div -->
2612
2613### <a id="benchmarksuiteoptionsname"></a>`Benchmark.Suite.options.name`
2614<a href="#benchmarksuiteoptionsname">#</a> [Ⓢ](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L3713 "View in source") [Ⓣ][1]
2615
2616*(String)*: The name of the suite.
2617
2618* * *
2619
2620<!-- /div -->
2621
2622
2623<!-- /div -->
2624
2625
2626<!-- /div -->
2627
2628
2629 [1]: #Benchmark "Jump back to the TOC."