0.1.8 • Published 9 years ago

benchmarkjs v0.1.8

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

BenchmarkJS

A easy bechmarking framework for Javascript code.

Installation

Installing with npm:

$ npm i --save benchmarkjs

This module don't have dependencies.

Use in a browser:

<script src="benchmarkjs.js"></script>

Use in Node.js:

var Benchmark = require('benchmarkjs');

Enable Node.js V8 native syntax for optimization check with this parameter:

node --allow-natives-syntax

Usage example:

var benchmarkjs = require('benchmarkjs');

benchmarkjs.options({
    verbose: true,
    time: 4000
});

var bigArray1 = new Array(1000);
benchmarkjs('n < max', function () {
    for (var n = 0, max = bigArray1.length; n < max; n++) {
        bigArray1[n] = 0 | Math.random() * 1000;
    }
});

var bigArray2 = new Array(1000);
benchmarkjs('n < hugeArray2.length', function () {
    for (var n = 0; n < bigArray2.length; n++) {
        bigArray2[n] = 0 | Math.random() * 1000;
    }
});

console.log(benchmarkjs.results);

Contributor

Pablo Almunia

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago