New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

benchmark

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

benchmark - npm Package Compare versions

Comparing version 0.1.337 to 0.1.338

37

benchmark.js
/*!
* benchmark.js
* Benchmark.js
* Copyright Mathias Bynens <http://mths.be/>

@@ -309,4 +309,3 @@ * Based on JSLitmus.js, copyright Robert Kieffer <http://broofa.com/>

timerRes = getRes('ns');
timerNS = timerRes <= min && timerNS;
TIMER_UNIT = 'ns';
timerNS = timerRes <= min && (TIMER_UNIT = 'ns', timerNS);
} catch(e) { }

@@ -321,4 +320,3 @@

timerRes = getRes('us');
timerNS = timerRes <= min && timerNS;
TIMER_UNIT = 'us';
timerNS = timerRes <= min && (TIMER_UNIT = 'us', timerNS);
} catch(e) { }

@@ -330,3 +328,2 @@ }

timerRes = getRes('ms');
TIMER_UNIT = 'ms';
}

@@ -375,3 +372,3 @@ // error if there are no working timers

function getStoreKey(me) {
return ['benchmark.js', TIMER_UNIT, me.fn.uid, Benchmark.platform].join(':');
return ['benchmark.js', 'r1', TIMER_UNIT, me.fn.uid, Benchmark.platform].join(':');
}

@@ -1034,5 +1031,6 @@

* @param {Boolean} [async=false] Flag to run asynchronously.
* @param {Boolean} [burst=false] Flag to run in bursts.
* @param {Array} [sample=[]] Benchmarks used for statistical analysis.
*/
function compute(me, async, sample) {
function compute(me, async, burst, sample) {
var calibrated = isCalibrated(),

@@ -1042,2 +1040,3 @@ calibrating = me.constructor == Calibration,

queue = [],
burstCount = async ? 2 : 48,
runCount = me.INIT_RUN_COUNT;

@@ -1048,3 +1047,3 @@

sample.push(queue[queue.push(me.clone({
'computing': queue,
'computing': true,
'events': {

@@ -1107,3 +1106,3 @@ 'complete': [onComplete],

elapsed = (now - times.start) / 1e3,
maxedOut = elapsed >= me.MAX_TIME_ELAPSED,
maxedOut = burst ? !--burstCount : async && elapsed >= me.MAX_TIME_ELAPSED,
sampleSize = sample.length,

@@ -1136,6 +1135,6 @@ sumOf = function(sum, clone) { return sum + clone.hz; },

if (rme > 1 && (!maxedOut || calibrating)) {
if (maxedOut && async) {
// switch to sync mode
if (maxedOut) {
// switch to burst mode
queue.length = 0;
compute(me, false, sample);
compute(me, !async, true, sample);
}

@@ -1469,3 +1468,3 @@ else {

if (description.length) {
description = ['(' + description.join(' ') + ')'];
description = ['(' + description.join('; ') + ')'];
}

@@ -1514,3 +1513,3 @@ // add product to description

*/
'version': '0.1.337',
'version': '0.1.338',

@@ -1795,2 +1794,6 @@ // clears locally stored data

extend(Calibration.prototype, {
// allows extremely small clock speeds
'DETECT_INFINITY': false,
// avoid repeat calibrations

@@ -1803,5 +1806,5 @@ 'persist': true

// expose
if (/Narwhal|Node|RingoJS/.test(Benchmark.platform.name)) {
if (typeof exports == 'object' && exports && typeof global == 'object' && global) {
window = global;
if (typeof module == 'object' && module.exports == exports) {
if (typeof module == 'object' && module && module.exports == exports) {
module.exports = Benchmark;

@@ -1808,0 +1811,0 @@ } else {

@@ -64,19 +64,19 @@ # Benchmark

# Benchmark
## <a name="static-CALIBRATIONS" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1489" title="View in source">Benchmark.CALIBRATIONS</a>
## <a name="static-CALIBRATIONS" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1488" title="View in source">Benchmark.CALIBRATIONS</a>
*(Array)*: Benchmarks to establish iteration overhead.
<sup><code>[&#9650;][1]</code></sup>
## <a name="static-platform" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1323" title="View in source">Benchmark.platform</a>
## <a name="static-platform" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1322" title="View in source">Benchmark.platform</a>
*(Boolean)*: Platform object containing browser name, version, and operating system.
<sup><code>[&#9650;][1]</code></sup>
## <a name="static-version" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1504" title="View in source">Benchmark.version</a>
## <a name="static-version" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1503" title="View in source">Benchmark.version</a>
*(String)*: The version number.
<sup><code>[&#9650;][1]</code></sup>
## <a name="static-clearStorage" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L428" title="View in source">Benchmark.clearStorage()</a>
## <a name="static-clearStorage" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L425" title="View in source">Benchmark.clearStorage()</a>
Removes all benchmark data from local storage.
<sup><code>[&#9650;][1]</code></sup>
## <a name="static-each" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L446" title="View in source">Benchmark.each(array, callback)</a>
## <a name="static-each" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L443" title="View in source">Benchmark.each(array, callback)</a>
A generic bare-bones `Array#forEach` solution.

@@ -90,3 +90,3 @@ Callbacks may terminate the loop by explicitly returning `false`.

## <a name="static-extend" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L465" title="View in source">Benchmark.extend(destination, source)</a>
## <a name="static-extend" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L462" title="View in source">Benchmark.extend(destination, source)</a>
Copies source properties to the destination object.

@@ -102,3 +102,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-filter" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L480" title="View in source">Benchmark.filter(array, callback)</a>
## <a name="static-filter" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L477" title="View in source">Benchmark.filter(array, callback)</a>
A generic bare-bones `Array#filter` solution.

@@ -114,3 +114,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-forIn" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L493" title="View in source">Benchmark.forIn(object, callback)</a>
## <a name="static-forIn" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L490" title="View in source">Benchmark.forIn(object, callback)</a>
A generic bare-bones for-in solution for an object's own properties.

@@ -123,3 +123,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-formatNumber" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L508" title="View in source">Benchmark.formatNumber(number)</a>
## <a name="static-formatNumber" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L505" title="View in source">Benchmark.formatNumber(number)</a>
Converts a number to a more readable comma-separated string representation.

@@ -134,3 +134,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-hasKey" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L526" title="View in source">Benchmark.hasKey(object, key)</a>
## <a name="static-hasKey" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L523" title="View in source">Benchmark.hasKey(object, key)</a>
Checks if an object has the specified key as a direct property.

@@ -146,3 +146,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-indexOf" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L555" title="View in source">Benchmark.indexOf(array, value)</a>
## <a name="static-indexOf" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L552" title="View in source">Benchmark.indexOf(array, value)</a>
A generic bare-bones `Array#indexOf` solution.

@@ -158,3 +158,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-interpolate" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L698" title="View in source">Benchmark.interpolate(string, object)</a>
## <a name="static-interpolate" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L695" title="View in source">Benchmark.interpolate(string, object)</a>
Modify a string by replacing named tokens with matching object property values.

@@ -176,3 +176,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-invoke" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L600" title="View in source">Benchmark.invoke(benches, methodName, args)</a>
## <a name="static-invoke" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L597" title="View in source">Benchmark.invoke(benches, methodName, args)</a>
Invokes a given method, with arguments, on all benchmarks in an array.

@@ -212,3 +212,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-isArray" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L713" title="View in source">Benchmark.isArray(value)</a>
## <a name="static-isArray" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L710" title="View in source">Benchmark.isArray(value)</a>
Determines if the given value is an array.

@@ -223,3 +223,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-isCalibrated" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L723" title="View in source">Benchmark.isCalibrated()</a>
## <a name="static-isCalibrated" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L720" title="View in source">Benchmark.isCalibrated()</a>
Checks if calibration benchmarks have completed.

@@ -231,3 +231,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-isClassOf" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L736" title="View in source">Benchmark.isClassOf(object, name)</a>
## <a name="static-isClassOf" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L733" title="View in source">Benchmark.isClassOf(object, name)</a>
Checks if an object is of the specified class.

@@ -243,3 +243,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-isHostType" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L750" title="View in source">Benchmark.isHostType(object, property)</a>
## <a name="static-isHostType" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L747" title="View in source">Benchmark.isHostType(object, property)</a>
Host objects can return type values that are different from their actual

@@ -257,3 +257,3 @@ data type. The objects we are concerned with usually return non-primitive

## <a name="static-join" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L764" title="View in source">Benchmark.join(object, separator1, separator2)</a>
## <a name="static-join" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L761" title="View in source">Benchmark.join(object, separator1, separator2)</a>
Creates a string of joined array values or object key-value pairs.

@@ -270,3 +270,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-map" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L786" title="View in source">Benchmark.map(array, callback)</a>
## <a name="static-map" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L783" title="View in source">Benchmark.map(array, callback)</a>
A generic bare-bones `Array#map` solution.

@@ -282,7 +282,7 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-noop" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L798" title="View in source">Benchmark.noop()</a>
## <a name="static-noop" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L795" title="View in source">Benchmark.noop()</a>
A no-operation function.
<sup><code>[&#9650;][1]</code></sup>
## <a name="static-reduce" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L811" title="View in source">Benchmark.reduce(array, callback, accumulator)</a>
## <a name="static-reduce" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L808" title="View in source">Benchmark.reduce(array, callback, accumulator)</a>
A generic bare-bones `Array#reduce` solution.

@@ -299,3 +299,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="static-trim" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L825" title="View in source">Benchmark.trim(string)</a>
## <a name="static-trim" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L822" title="View in source">Benchmark.trim(string)</a>
A generic bare-bones `String#trim` solution.

@@ -312,107 +312,107 @@ <sup><code>[&#9650;][1]</code></sup>

# Benchmark.prototype
## <a name="CALIBRATION_INDEX" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1576" title="View in source">Benchmark#CALIBRATION_INDEX</a>
## <a name="CALIBRATION_INDEX" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1575" title="View in source">Benchmark#CALIBRATION_INDEX</a>
*(Number)*: The index of the calibration benchmark to use when computing results.
<sup><code>[&#9650;][1]</code></sup>
## <a name="CYCLE_DELAY" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1583" title="View in source">Benchmark#CYCLE_DELAY</a>
## <a name="CYCLE_DELAY" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1582" title="View in source">Benchmark#CYCLE_DELAY</a>
*(Number)*: The delay between test cycles *(secs)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="DEFAULT_ASYNC" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1590" title="View in source">Benchmark#DEFAULT_ASYNC</a>
## <a name="DEFAULT_ASYNC" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1589" title="View in source">Benchmark#DEFAULT_ASYNC</a>
*(Boolean)*: A flag to indicate methods will run asynchronously by default.
<sup><code>[&#9650;][1]</code></sup>
## <a name="DETECT_INFINITY" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1597" title="View in source">Benchmark#DETECT_INFINITY</a>
## <a name="DETECT_INFINITY" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1596" title="View in source">Benchmark#DETECT_INFINITY</a>
*(Boolean)*: A flag to indicate protection against large run counts if Infinity ops/sec is detected.
<sup><code>[&#9650;][1]</code></sup>
## <a name="INIT_RUN_COUNT" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1604" title="View in source">Benchmark#INIT_RUN_COUNT</a>
## <a name="INIT_RUN_COUNT" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1603" title="View in source">Benchmark#INIT_RUN_COUNT</a>
*(Number)*: The default number of times to execute a test on a benchmark's first cycle.
<sup><code>[&#9650;][1]</code></sup>
## <a name="MAX_TIME_ELAPSED" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1611" title="View in source">Benchmark#MAX_TIME_ELAPSED</a>
## <a name="MAX_TIME_ELAPSED" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1610" title="View in source">Benchmark#MAX_TIME_ELAPSED</a>
*(Number)*: The maximum time a benchmark is allowed to run before finishing *(secs)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="MIN_TIME" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1618" title="View in source">Benchmark#MIN_TIME</a>
## <a name="MIN_TIME" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1617" title="View in source">Benchmark#MIN_TIME</a>
*(Number)*: The time needed to reduce the percent uncertainty of measurement to `1`% *(secs)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="MoE" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1625" title="View in source">Benchmark#MoE</a>
## <a name="MoE" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1624" title="View in source">Benchmark#MoE</a>
*(Number)*: The margin of error.
<sup><code>[&#9650;][1]</code></sup>
## <a name="RME" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1632" title="View in source">Benchmark#RME</a>
## <a name="RME" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1631" title="View in source">Benchmark#RME</a>
*(Number)*: The relative margin of error *(expressed as a percentage of the mean)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="SD" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1639" title="View in source">Benchmark#SD</a>
## <a name="SD" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1638" title="View in source">Benchmark#SD</a>
*(Number)*: The sample standard deviation.
<sup><code>[&#9650;][1]</code></sup>
## <a name="SEM" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1646" title="View in source">Benchmark#SEM</a>
## <a name="SEM" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1645" title="View in source">Benchmark#SEM</a>
*(Number)*: The standard error of the mean.
<sup><code>[&#9650;][1]</code></sup>
## <a name="aborted" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1688" title="View in source">Benchmark#aborted</a>
## <a name="aborted" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1687" title="View in source">Benchmark#aborted</a>
*(Boolean)*: A flag to indicate if the benchmark is aborted.
<sup><code>[&#9650;][1]</code></sup>
## <a name="count" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1653" title="View in source">Benchmark#count</a>
## <a name="count" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1652" title="View in source">Benchmark#count</a>
*(Number)*: The number of times a test was executed.
<sup><code>[&#9650;][1]</code></sup>
## <a name="created" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1660" title="View in source">Benchmark#created</a>
## <a name="created" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1659" title="View in source">Benchmark#created</a>
*(Number)*: A timestamp of when the benchmark was created.
<sup><code>[&#9650;][1]</code></sup>
## <a name="cycles" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1667" title="View in source">Benchmark#cycles</a>
## <a name="cycles" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1666" title="View in source">Benchmark#cycles</a>
*(Number)*: The number of cycles performed while benchmarking.
<sup><code>[&#9650;][1]</code></sup>
## <a name="error" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1674" title="View in source">Benchmark#error</a>
## <a name="error" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1673" title="View in source">Benchmark#error</a>
*(Object|Null)*: The error object if the test failed.
<sup><code>[&#9650;][1]</code></sup>
## <a name="hz" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1681" title="View in source">Benchmark#hz</a>
## <a name="hz" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1680" title="View in source">Benchmark#hz</a>
*(Number)*: The number of executions per second.
<sup><code>[&#9650;][1]</code></sup>
## <a name="persist" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1695" title="View in source">Benchmark#persist</a>
## <a name="persist" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1694" title="View in source">Benchmark#persist</a>
*(Mixed)*: A flag to indicate if results persist OR the number of days to persist.
<sup><code>[&#9650;][1]</code></sup>
## <a name="running" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1702" title="View in source">Benchmark#running</a>
## <a name="running" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1701" title="View in source">Benchmark#running</a>
*(Boolean)*: A flag to indicate if the benchmark is running.
<sup><code>[&#9650;][1]</code></sup>
## <a name="times" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1715" title="View in source">Benchmark#times</a>
## <a name="times" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1714" title="View in source">Benchmark#times</a>
*(Object)*: An object of timing data including cycle, elapsed, period, start, and stop.
<sup><code>[&#9650;][1]</code></sup>
## <a name="cycle" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1722" title="View in source">Benchmark#times.cycle</a>
## <a name="cycle" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1721" title="View in source">Benchmark#times.cycle</a>
*(Number)*: The time taken to complete the last cycle *(secs)*
<sup><code>[&#9650;][1]</code></sup>
## <a name="elapsed" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1729" title="View in source">Benchmark#times.elapsed</a>
## <a name="elapsed" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1728" title="View in source">Benchmark#times.elapsed</a>
*(Number)*: The time taken to complete the benchmark *(secs)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="period" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1736" title="View in source">Benchmark#times.period</a>
## <a name="period" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1735" title="View in source">Benchmark#times.period</a>
*(Number)*: The time taken to execute the test once *(secs)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="start" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1743" title="View in source">Benchmark#times.start</a>
## <a name="start" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1742" title="View in source">Benchmark#times.start</a>
*(Number)*: A timestamp of when the benchmark started *(ms)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="stop" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1750" title="View in source">Benchmark#times.stop</a>
## <a name="stop" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1749" title="View in source">Benchmark#times.stop</a>
*(Number)*: A timestamp of when the benchmark finished *(ms)*.
<sup><code>[&#9650;][1]</code></sup>
## <a name="abort" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L908" title="View in source">Benchmark#abort()</a>
## <a name="abort" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L905" title="View in source">Benchmark#abort()</a>
Aborts the benchmark as well as in progress calibrations without recording times.
<sup><code>[&#9650;][1]</code></sup>
## <a name="addListener" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L838" title="View in source">Benchmark#addListener(type, listener)</a>
## <a name="addListener" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L835" title="View in source">Benchmark#addListener(type, listener)</a>
Registers a single listener of a specified event type.

@@ -428,3 +428,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="clone" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L938" title="View in source">Benchmark#clone(options)</a>
## <a name="clone" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L935" title="View in source">Benchmark#clone(options)</a>
Creates a cloned benchmark with the same test function and options.

@@ -444,3 +444,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="compare" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L958" title="View in source">Benchmark#compare(other)</a>
## <a name="compare" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L955" title="View in source">Benchmark#compare(other)</a>
Determines if the benchmark's hertz is higher than another.

@@ -455,3 +455,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="emit" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L852" title="View in source">Benchmark#emit(type)</a>
## <a name="emit" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L849" title="View in source">Benchmark#emit(type)</a>
Executes all registered listeners of a specified event type.

@@ -463,7 +463,7 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="on" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1708" title="View in source">Benchmark#on</a>
## <a name="on" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1707" title="View in source">Benchmark#on</a>
Alias of [`Benchmark#addListener`](#addListener).
<sup><code>[&#9650;][1]</code></sup>
## <a name="removeAllListeners" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L893" title="View in source">Benchmark#removeAllListeners(type)</a>
## <a name="removeAllListeners" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L890" title="View in source">Benchmark#removeAllListeners(type)</a>
Unregisters all listeners of a specified event type.

@@ -478,3 +478,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="removeListener" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L875" title="View in source">Benchmark#removeListener(type, listener)</a>
## <a name="removeListener" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L872" title="View in source">Benchmark#removeListener(type, listener)</a>
Unregisters a single listener of a specified event type.

@@ -490,7 +490,7 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="reset" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L969" title="View in source">Benchmark#reset()</a>
## <a name="reset" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L966" title="View in source">Benchmark#reset()</a>
Reset properties and abort if running.
<sup><code>[&#9650;][1]</code></sup>
## <a name="run" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1286" title="View in source">Benchmark#run(async)</a>
## <a name="run" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1285" title="View in source">Benchmark#run(async)</a>
Starts running the benchmark.

@@ -502,3 +502,3 @@ <sup><code>[&#9650;][1]</code></sup>

## <a name="toString" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1006" title="View in source">Benchmark#toString()</a>
## <a name="toString" href="https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1003" title="View in source">Benchmark#toString()</a>
Displays relevant benchmark information when coerced to a string.

@@ -505,0 +505,0 @@ <sup><code>[&#9650;][1]</code></sup>

{
"name": "benchmark",
"version": "0.1.337",
"version": "0.1.338",
"description": "A benchmarking library that works on nearly all JavaScript platforms, supports high-resolution timers, and returns statistically significant results.",

@@ -5,0 +5,0 @@ "homepage": "http://benchmarkjs.com/",

# Benchmark.js
A robust benchmarking library that works on nearly all JavaScript platforms, supports high-resolution timers, and returns statistically significant results. As seen on [jsPerf](http://jsperf.com/).
A [robust](http://calendar.perfplanet.com/2010/bulletproof-javascript-benchmarks/ "Bulletproof JavaScript benchmarks") benchmarking library that works on nearly all JavaScript platforms, supports high-resolution timers, and returns statistically significant results. As seen on [jsPerf](http://jsperf.com/).
You can read more about [bulletproof JavaScript benchmarks](http://calendar.perfplanet.com/2010/bulletproof-javascript-benchmarks/) if you like.
## Project history
Benchmark.js started out as a heavily modified version of the excellent [JSLitmus](http://broofa.com/Tools/JSLitmus/) by Robert Kieffer ([GitHub](http://github.com/broofa/jslitmus)). It uses adaptive test cycles, meaning every test will roughly take the same amount of time, regardless of the operation. Thanks to this awesome feature, jsPerf tests can be run in any browser, on any device — including smartphones.
In October 2010, [John-David Dalton](http://allyoucanleet.com/) started collaborating on the project, providing some major contributions to Benchmark.js and its UI for jsPerf ([`ui.js`](https://github.com/mathiasbynens/benchmark.js/blob/master/examples/jsperf/ui.js)).
## Documentation

@@ -23,2 +15,6 @@

Optionally, add the `nanoTime` Java applet to the `<body>`:
<applet code="nano" archive="nano.jar"></applet>
Via [npm](http://npmjs.org/):

@@ -54,2 +50,5 @@

_— [Mathias](http://mathiasbynens.be/)_
## Authors
* [Mathias Bynens](http://mathiasbynens.be/)
* [John-David Dalton](http://allyoucanleet.com/)

@@ -80,3 +80,3 @@ module("Benchmark.platform");

'Android Browser 4.1#{alpha} (platform preview like Safari 4+) on Android 2.2.1': {
'Android Browser 4.1#{alpha} (platform preview; like Safari 4+) on Android 2.2.1': {
'ua': 'Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.1a Mobile Safari/533.1',

@@ -278,3 +278,3 @@ 'external': null

'IE 9.0#{beta} (platform preview running in IE 5 mode) on Windows 7': {
'IE 9.0#{beta} (platform preview; running in IE 5 mode) on Windows 7': {
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',

@@ -286,3 +286,3 @@ 'appMinorVersion': 'beta',

'IE 9.0#{beta} (platform preview running in IE 7 mode) on Windows 7': {
'IE 9.0#{beta} (platform preview; running in IE 7 mode) on Windows 7': {
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',

@@ -294,3 +294,3 @@ 'appMinorVersion': 'beta',

'IE 9.0#{beta} (platform preview running in IE 8 mode) on Windows 7': {
'IE 9.0#{beta} (platform preview; running in IE 8 mode) on Windows 7': {
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',

@@ -375,3 +375,3 @@ 'appMinorVersion': 'beta',

'Lunascape 6.3.1.22729#{beta} (platform preview rendered by Trident) on Windows Vista': {
'Lunascape 6.3.1.22729#{beta} (platform preview; rendered by Trident) on Windows Vista': {
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Lunascape/6.3.1.22729',

@@ -407,3 +407,3 @@ 'appMinorVersion': 'beta',

'Maxthon 3.x#{alpha} (platform preview rendered by Trident) on Windows XP': {
'Maxthon 3.x#{alpha} (platform preview; rendered by Trident) on Windows XP': {
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Maxthon/3.0)',

@@ -785,3 +785,3 @@ 'appMinorVersion': 'alpha',

'Sleipnir 2.9.2#{beta} (platform preview rendered by Trident) on Windows XP': {
'Sleipnir 2.9.2#{beta} (platform preview; rendered by Trident) on Windows XP': {
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Sleipnir/2.9.2)',

@@ -788,0 +788,0 @@ 'appMinorVersion': 'beta',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc