eruda-benchmark
v2.0.1
Published
Eruda plugin for running JavaScript benchmarks
Downloads
532
Readme
eruda-benchmark
Eruda plugin for running JavaScript benchmarks.
Demo
Browse it on your phone: http://eruda.liriliri.io/?plugin=benchmark
Install
npm install eruda-benchmark --save
eruda.add(erudaBenchmark);
Make sure Eruda is loaded before this plugin, otherwise won't work.
Usage
After initialization:
var benchmark = eruda.get('benchmark');
benchmark.add('Test', function ()
{
var arr = new Array(10000);
for (var i = 0; i < 10000; i++) arr[i] = i * 2;
});
benchmark.add('Test Suite', [
{
name: 'RegExp#test',
fn: function ()
{
/o/.test('Hello World!');
}
},
{
name: 'String#indexOf',
fn: function ()
{
'Hello World!'.indexOf('o') > -1;
}
},
{
name: 'String#match',
fn: function ()
{
!!'Hello World!'.match(/o/);
}
}
]);