Benchmark.js v2.1.4
Benchmark
Benchmark.Deferred
Benchmark.Deferred.prototype.resolve
Benchmark.Event
Benchmark.Suite
Benchmark.Suite.prototype.abort
Benchmark.Suite.prototype.add
Benchmark.Suite.prototype.clone
Benchmark.Suite.prototype.filter
Benchmark.Suite.prototype.reset
Benchmark.Suite.prototype.run
Benchmark.filter
Benchmark.formatNumber
Benchmark.invoke
Benchmark.join
Benchmark.runInContext
Benchmark.prototype.abort
Benchmark.prototype.clone
Benchmark.prototype.compare
Benchmark.prototype.emit
Benchmark.prototype.listeners
Benchmark.prototype.off
Benchmark.prototype.on
Benchmark.prototype.reset
Benchmark.prototype.run
Benchmark.prototype.toString
Benchmark.Deferred.prototype.benchmark
Benchmark.Deferred.prototype.cycles
Benchmark.Deferred.prototype.elapsed
Benchmark.Deferred.prototype.timeStamp
Benchmark.Event.prototype.aborted
Benchmark.Event.prototype.cancelled
Benchmark.Event.prototype.currentTarget
Benchmark.Event.prototype.result
Benchmark.Event.prototype.target
Benchmark.Event.prototype.timeStamp
Benchmark.Event.prototype.type
Benchmark.Suite.options
Benchmark.Suite.options.name
Benchmark.Suite.prototype.aborted
Benchmark.Suite.prototype.length
Benchmark.Suite.prototype.running
Benchmark.options
Benchmark.options.async
Benchmark.options.defer
Benchmark.options.delay
Benchmark.options.id
Benchmark.options.initCount
Benchmark.options.maxTime
Benchmark.options.minSamples
Benchmark.options.minTime
Benchmark.options.name
Benchmark.options.onAbort
Benchmark.options.onComplete
Benchmark.options.onCycle
Benchmark.options.onError
Benchmark.options.onReset
Benchmark.options.onStart
Benchmark.platform
Benchmark.support
Benchmark.support.browser
Benchmark.version
Benchmark.prototype.aborted
Benchmark.prototype.compiled
Benchmark.prototype.count
Benchmark.prototype.cycles
Benchmark.support.decompilation
Benchmark.prototype.error
Benchmark.prototype.fn
Benchmark.prototype.hz
Benchmark.prototype.running
Benchmark.prototype.setup
Benchmark.prototype.stats
Benchmark.prototype.teardown
Benchmark.support.timeout
Benchmark.prototype.times
Benchmark#stats.deviation
Benchmark#stats.mean
Benchmark#stats.moe
Benchmark#stats.rme
Benchmark#stats.sample
Benchmark#stats.sem
Benchmark#stats.variance
Benchmark#times.cycle
Benchmark#times.elapsed
Benchmark#times.period
Benchmark#times.timeStamp
The Benchmark constructor.
Note: The Benchmark constructor exposes a handful of lodash methods to
make working with arrays, collections, and objects easier. The lodash
methods are:
each/forEach
, forOwn
,
has
, indexOf
,
map
, and reduce
name
(string): A name to identify the benchmark.fn
(Function|string): The test to benchmark.[options={}]
(Object): Options object.
// basic usage (the `new` operator is optional)
var bench = new Benchmark(fn);
// or using a name first
var bench = new Benchmark('foo', fn);
// or with options
var bench = new Benchmark('foo', fn, {
// displayed by `Benchmark#toString` if `name` is not available
'id': 'xyz',
// called when the benchmark starts running
'onStart': onStart,
// called after each run cycle
'onCycle': onCycle,
// called when aborted
'onAbort': onAbort,
// called when a test errors
'onError': onError,
// called when reset
'onReset': onReset,
// called when the benchmark completes running
'onComplete': onComplete,
// compiled/called before the test loop
'setup': setup,
// compiled/called after the test loop
'teardown': teardown
});
// or name and options
var bench = new Benchmark('foo', {
// a flag to indicate the benchmark is deferred
'defer': true,
// benchmark test function
'fn': function(deferred) {
// call `Deferred#resolve` when the deferred test is finished
deferred.resolve();
}
});
// or options only
var bench = new Benchmark({
// benchmark name
'name': 'foo',
// benchmark test as a string
'fn': '[1,2,3,4].sort()'
});
// a test's `this` binding is set to the benchmark instance
var bench = new Benchmark('foo', function() {
'My name is '.concat(this.name); // "My name is foo"
});
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L399 "View in source") [Ⓣ][1]
The Deferred constructor.
clone
(Object): The cloned benchmark instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L716 "View in source") [Ⓣ][1]
Handles cycling/completing the deferred benchmark.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L415 "View in source") [Ⓣ][1]
The Event constructor.
type
(Object|string): The event type.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L467 "View in source") [Ⓣ][1]
The Suite constructor.
Note: Each Suite instance has a handful of wrapped lodash methods to
make working with Suites easier. The wrapped lodash methods are:
each/forEach
, indexOf
,
map
, and reduce
name
(string): A name to identify the suite.[options={}]
(Object): Options object.
// basic usage (the `new` operator is optional)
var suite = new Benchmark.Suite;
// or using a name first
var suite = new Benchmark.Suite('foo');
// or with options
var suite = new Benchmark.Suite('foo', {
// called when the suite starts running
'onStart': onStart,
// called between running benchmarks
'onCycle': onCycle,
// called when aborted
'onAbort': onAbort,
// called when a test errors
'onError': onError,
// called when reset
'onReset': onReset,
// called when the suite completes running
'onComplete': onComplete
});
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1008 "View in source") [Ⓣ][1]
Aborts all benchmarks in the suite.
(Object): The suite instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1068 "View in source") [Ⓣ][1]
Adds a test to the benchmark suite.
name
(string): A name to identify the benchmark.fn
(Function|string): The test to benchmark.[options={}]
(Object): Options object.
(Object): The suite instance.
// basic usage
suite.add(fn);
// or using a name first
suite.add('foo', fn);
// or with options
suite.add('foo', fn, {
'onCycle': onCycle,
'onComplete': onComplete
});
// or name and options
suite.add('foo', {
'fn': fn,
'onCycle': onCycle,
'onComplete': onComplete
});
// or options only
suite.add({
'name': 'foo',
'fn': fn,
'onCycle': onCycle,
'onComplete': onComplete
});
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1087 "View in source") [Ⓣ][1]
Creates a new suite with cloned benchmarks.
options
(Object): Options object to overwrite cloned options.
(Object): The new suite instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1110 "View in source") [Ⓣ][1]
An Array#filter
like method.
callback
(Function|string): The function/alias called per iteration.
(Object): A new suite of benchmarks that passed callback filter.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1125 "View in source") [Ⓣ][1]
Resets all benchmarks in the suite.
(Object): The suite instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1162 "View in source") [Ⓣ][1]
Runs the suite.
[options={}]
(Object): Options object.
(Object): The suite instance.
// basic usage
suite.run();
// or with options
suite.run({ 'async': true, 'queued': true });
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L763 "View in source") [Ⓣ][1]
A generic Array#filter
like method.
array
(Array): The array to iterate over.callback
(Function|string): The function/alias called per iteration.
(Array): A new array of values that passed callback filter.
// get odd numbers
Benchmark.filter([1, 2, 3, 4, 5], function(n) {
return n % 2;
}); // -> [1, 3, 5];
// get fastest benchmarks
Benchmark.filter(benches, 'fastest');
// get slowest benchmarks
Benchmark.filter(benches, 'slowest');
// get benchmarks that completed without erroring
Benchmark.filter(benches, 'successful');
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L792 "View in source") [Ⓣ][1]
Converts a number to a more readable comma-separated string representation.
number
(number): The number to convert.
(string): The more readable string representation.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L837 "View in source") [Ⓣ][1]
Invokes a method on all items in an array.
benches
(Array): Array of benchmarks to iterate over.name
(Object|string): The name of the method to invoke OR options object.[args]
(...*): Arguments to invoke the method with.
(Array): A new array of values returned from each method invoked.
// invoke `reset` on all benchmarks
Benchmark.invoke(benches, 'reset');
// invoke `emit` with arguments
Benchmark.invoke(benches, 'emit', 'complete', listener);
// invoke `run(true)`, treat benchmarks as a queue, and register invoke callbacks
Benchmark.invoke(benches, {
// invoke the `run` method
'name': 'run',
// pass a single argument
'args': true,
// treat as queue, removing benchmarks from front of `benches` until empty
'queued': true,
// called before any benchmarks have been invoked.
'onStart': onStart,
// called between invoking benchmarks
'onCycle': onCycle,
// called after all benchmarks have been invoked.
'onComplete': onComplete
});
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L987 "View in source") [Ⓣ][1]
Creates a string of joined array values or object key-value pairs.
object
(Array|Object): The object to operate on.[separator1=',']
(string): The separator used between key-value pairs.[separator2=': ']
(string): The separator used between keys and values.
(string): The joined result.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L125 "View in source") [Ⓣ][1]
Create a new Benchmark
function using the given context
object.
[context=root]
(Object): The context object.
(Function): Returns a new Benchmark
function.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1328 "View in source") [Ⓣ][1]
Aborts the benchmark without recording times.
(Object): The benchmark instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1367 "View in source") [Ⓣ][1]
Creates a new benchmark using the same test and options.
options
(Object): Options object to overwrite cloned options.
(Object): The new benchmark instance.
var bizarro = bench.clone({
'name': 'doppelganger'
});
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1391 "View in source") [Ⓣ][1]
Determines if a benchmark is faster than another.
other
(Object): The benchmark to compare.
(number): Returns -1
if slower, 1
if faster, and 0
if indeterminate.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1202 "View in source") [Ⓣ][1]
Executes all registered listeners of the specified event type.
type
(Object|string): The event type or object.[args]
(...*): Arguments to invoke the listener with.
(*): Returns the return value of the last listener executed.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1232 "View in source") [Ⓣ][1]
Returns an array of event listeners for a given type that can be manipulated to add or remove listeners.
type
(string): The event type.
(Array): The listeners array.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1265 "View in source") [Ⓣ][1]
Unregisters 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.
[type]
(string): The event type.[listener]
(Function): The function to unregister.
(Object): The current instance.
// unregister a listener for an event type
bench.off('cycle', listener);
// unregister a listener for multiple event types
bench.off('start cycle', listener);
// unregister all listeners for an event type
bench.off('cycle');
// unregister all listeners for multiple event types
bench.off('start cycle complete');
// unregister all listeners for all event types
bench.off();
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1307 "View in source") [Ⓣ][1]
Registers a listener for the specified event type(s).
type
(string): The event type.listener
(Function): The function to register.
(Object): The current instance.
// register a listener for an event type
bench.on('cycle', listener);
// register a listener for multiple event types
bench.on('start cycle', listener);
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1444 "View in source") [Ⓣ][1]
Reset properties and abort if running.
(Object): The benchmark instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2093 "View in source") [Ⓣ][1]
Runs the benchmark.
[options={}]
(Object): Options object.
(Object): The benchmark instance.
// basic usage
bench.run();
// or with options
bench.run({ 'async': true });
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L1525 "View in source") [Ⓣ][1]
Displays relevant benchmark information when coerced to a string.
(string): A string representation of the benchmark instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2583 "View in source") [Ⓣ][1]
The deferred benchmark instance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2591 "View in source") [Ⓣ][1]
The number of deferred cycles performed while benchmarking.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2599 "View in source") [Ⓣ][1]
The time taken to complete the deferred benchmark (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2607 "View in source") [Ⓣ][1]
A timestamp of when the deferred benchmark started (ms).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2624 "View in source") [Ⓣ][1]
A flag to indicate if the emitters listener iteration is aborted.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2632 "View in source") [Ⓣ][1]
A flag to indicate if the default action is cancelled.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2640 "View in source") [Ⓣ][1]
The object whose listeners are currently being processed.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2648 "View in source") [Ⓣ][1]
The return value of the last executed listener.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2656 "View in source") [Ⓣ][1]
The object to which the event was originally emitted.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2664 "View in source") [Ⓣ][1]
A timestamp of when the event was created (ms).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2672 "View in source") [Ⓣ][1]
The event type.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2684 "View in source") [Ⓣ][1]
The default options copied by suite instances.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2692 "View in source") [Ⓣ][1]
The name of the suite.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2713 "View in source") [Ⓣ][1]
A flag to indicate if the suite is aborted.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2705 "View in source") [Ⓣ][1]
The number of benchmarks in the suite.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2721 "View in source") [Ⓣ][1]
A flag to indicate if the suite is running.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2142 "View in source") [Ⓣ][1]
The default options copied by benchmark instances.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2151 "View in source") [Ⓣ][1]
A flag to indicate that benchmark cycles will execute asynchronously by default.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2159 "View in source") [Ⓣ][1]
A flag to indicate that the benchmark clock is deferred.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2166 "View in source") [Ⓣ][1]
The delay between test cycles (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2175 "View in source") [Ⓣ][1]
Displayed by Benchmark#toString
when a name
is not available
(auto-generated if absent).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2183 "View in source") [Ⓣ][1]
The default number of times to execute a test on a benchmark's first cycle.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2193 "View in source") [Ⓣ][1]
The maximum time a benchmark is allowed to run before finishing (secs).
Note: Cycle delays aren't counted toward the maximum time.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2201 "View in source") [Ⓣ][1]
The minimum sample size required to perform statistical analysis.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2209 "View in source") [Ⓣ][1]
The time needed to reduce the percent uncertainty of measurement to 1
% (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2217 "View in source") [Ⓣ][1]
The name of the benchmark.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2225 "View in source") [Ⓣ][1]
An event listener called when the benchmark is aborted.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2233 "View in source") [Ⓣ][1]
An event listener called when the benchmark completes running.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2241 "View in source") [Ⓣ][1]
An event listener called after each run cycle.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2249 "View in source") [Ⓣ][1]
An event listener called when a test errors.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2257 "View in source") [Ⓣ][1]
An event listener called when the benchmark is reset.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2265 "View in source") [Ⓣ][1]
An event listener called when the benchmark starts running.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2276 "View in source") [Ⓣ][1]
Platform object with properties describing things like browser name,
version, and operating system. See platform.js
.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L195 "View in source") [Ⓣ][1]
An object used to flag environments/features.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L205 "View in source") [Ⓣ][1]
Detect if running in a browser environment.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2297 "View in source") [Ⓣ][1]
The semantic version number.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2372 "View in source") [Ⓣ][1]
A flag to indicate if the benchmark is aborted.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2348 "View in source") [Ⓣ][1]
The compiled test function.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2324 "View in source") [Ⓣ][1]
The number of times a test was executed.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2332 "View in source") [Ⓣ][1]
The number of cycles performed while benchmarking.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L222 "View in source") [Ⓣ][1]
Detect if function decompilation is support.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2356 "View in source") [Ⓣ][1]
The error object if the test failed.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2364 "View in source") [Ⓣ][1]
The test to benchmark.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2340 "View in source") [Ⓣ][1]
The number of executions per second.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2380 "View in source") [Ⓣ][1]
A flag to indicate if the benchmark is running.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2443 "View in source") [Ⓣ][1]
Compiled into the test and executed immediately before the test loop.
// basic usage
var bench = Benchmark({
'setup': function() {
var c = this.count,
element = document.getElementById('container');
while (c--) {
element.appendChild(document.createElement('div'));
}
},
'fn': function() {
element.removeChild(element.lastChild);
}
});
// compiles to something like:
var c = this.count,
element = document.getElementById('container');
while (c--) {
element.appendChild(document.createElement('div'));
}
var start = new Date;
while (count--) {
element.removeChild(element.lastChild);
}
var end = new Date - start;
// or using strings
var bench = Benchmark({
'setup': '\
var a = 0;\n\
(function() {\n\
(function() {\n\
(function() {',
'fn': 'a += 1;',
'teardown': '\
}())\n\
}())\n\
}())'
});
// compiles to something like:
var a = 0;
(function() {
(function() {
(function() {
var start = new Date;
while (count--) {
a += 1;
}
var end = new Date - start;
}())
}())
}())
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2459 "View in source") [Ⓣ][1]
An object of stats including mean, margin or error, and standard deviation.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2451 "View in source") [Ⓣ][1]
Compiled into the test and executed immediately after the test loop.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L213 "View in source") [Ⓣ][1]
Detect if the Timers API exists.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2524 "View in source") [Ⓣ][1]
An object of timing data including cycle, elapsed, period, start, and stop.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2491 "View in source") [Ⓣ][1]
The sample standard deviation.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2499 "View in source") [Ⓣ][1]
The sample arithmetic mean (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2467 "View in source") [Ⓣ][1]
The margin of error.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2475 "View in source") [Ⓣ][1]
The relative margin of error (expressed as a percentage of the mean).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2507 "View in source") [Ⓣ][1]
The array of sampled periods.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2483 "View in source") [Ⓣ][1]
The standard error of the mean.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2515 "View in source") [Ⓣ][1]
The sample variance.
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2532 "View in source") [Ⓣ][1]
The time taken to complete the last cycle (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2540 "View in source") [Ⓣ][1]
The time taken to complete the benchmark (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2548 "View in source") [Ⓣ][1]
The time taken to execute the test once (secs).
[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2556 "View in source") [Ⓣ][1]
A timestamp of when the benchmark started (ms).