Eruda plugin for running JavaScript benchmarks.
Browse it on your phone: http://eruda.liriliri.io/?plugin=benchmark
npm install eruda-benchmark --save
eruda.add(erudaBenchmark);
Make sure Eruda is loaded before this plugin, otherwise won't work.
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/);
}
}
]);