How to use the benchmark.Benchmark.Suite function in benchmark

To help you get started, we’ve selected a few benchmark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mourner / simplify-js / benchmark.js View on Github external
var Benchmark = require('benchmark').Benchmark;
var points = require('./website/test-data');

var suite = new Benchmark.Suite;

// add tests
suite
.add('original', function () {
    original(points, 0.8);
})
.add('one stack', function () {
    oneStack(points, 0.8);
})
.add('one stack calvin', function () {
    oneStackCalvin(points, 0.8);
})
// add listeners
.on('cycle', function(event) {
    console.log(String(event.target));
})
github torworx / ovy / benchmark / mix.js View on Github external
var ovy = require('../ovy');
var jsface = require('jsface');
require('./lib/augment');

var Benchmark = require('benchmark').Benchmark;
var suite = new Benchmark.Suite('benchmark');

var Person = function(name) {
    this.name = name;
};

// ovy Inherits Define
var OvyInheritsCanSing = ovy.define({
    sing: function(songName) {
        //
    }
});

var OvyInheritsCanPlayGuitar = ovy.define({
    playGuitar: function() {
        //
    }
github dkraczkowski / js.class / benchmark / class-declaration.js View on Github external
var JSClass = require('../src/js.class.js');
var Class = require('class');
var EEClass = require('ee-class');
var klass = require('klass');
var Benchmark = require('benchmark').Benchmark;

var suite = new Benchmark.Suite;

// add tests
suite.add('ee-class', function() {
    var Animal = new EEClass({
        init: function(){},
        eat: function() {},
        sleep: function() {}
    });

    var bobby = new Animal();
}).add('js.class', function() {
    var Animal = JSClass({
        create: function() {},
        eat: function() {},
        sleep: function() {}
    });
github torworx / ovy / benchmark / oop.js View on Github external
var Benchmark = require('benchmark').Benchmark;
var ovy = require('../ovy');
var jsface = require('jsface');
var util = require('util');

process._dejavu = {
    rc: {
        loose: true
    }
}
var dejavu = require('dejavu');


var suite = new Benchmark.Suite('benchmark');

// util.inherit
var Person = function(name) {
    this.name = name;
}

Person.prototype.setAddress = function(country, city, street) {
    this.country = country;
    this.city = city;
    this.street = street;
}

var ChinaGuy = function(name) {
    Person.call(this, name);
}
github urbit / urbit / outside / commonmark / js / bench.js View on Github external
var Benchmark = require('benchmark').Benchmark;
var suite = new Benchmark.Suite;
var fs = require('fs');
var sm = require('./lib/index.js');
// https://github.com/coreyti/showdown
var showdown = require('../../showdown/src/showdown');
// https://github.com/chjj/marked
var marked = require('../../marked/marked.min.js');

var benchfile = process.argv[2];

var contents = fs.readFileSync(benchfile, 'utf8');

// var converter = new showdown.converter();

suite.add('commonmark.js markdown->html', function() {
  var doc = new sm.DocParser().parse(contents);
  var renderer = new sm.HtmlRenderer();
github r3mi / poly2tri.js / tests / benchmark.js View on Github external
/*
 * Benchmarking tests for poly2tri.js
 *
 * (c) 2013-2014, Rémi Turboult
 * All rights reserved.
 * Distributed under the 3-clause BSD License, see LICENSE.txt
 */

"use strict";

var Benchmark = require('benchmark').Benchmark;
var load = require('load');
var Linespin = require('linespin');
var bars = require('jstrace-bars');

var suite = new Benchmark.Suite();


function makePoint(x, y, poly2tri) {
    return new poly2tri.Point(x, y);
}
function makeXY(x, y) {
    return { x: x, y: y };
}
function makeXY_(x, y) {
    return { x: x, y: y, _p2t_edge_list: null };
}

/*
 * Define the known poly2tri versions
 */
github JazzleWare / jazzle-parser / bench / run.js View on Github external
for ( sourceName in sources ) {
 var l = 1;
 while ( l-- ) {
     if ( parsers.esprima && parsers.jazzle ) {
          var comp =  util.compare_ea(
            parsers.esprima(sources[sourceName],!false),
            parsers.jazzle(sources[sourceName],!false),
            "", util.ej_adjust);

          if ( comp ) {
            console.log( util.obj2str(comp) );
            throw new Error( 'Incompatible Parsing for ' + sourceName );
          }
     }     

     var benchmarkSet = new Benchmark.Suite();
     var str = process.argv[2] || randJEAP() ;
     var e = 0;
     while ( e < str.length ) { 
       var parserName = parserNames[str[e]];
       benchmarkSet.add( parserName, parseLater(parserName, sourceName) );
       e++ ;
     }

     benchmarkSet.on( 'complete', function(r) {
        var currentTargets = r.currentTarget, i;
        i = 0;
        console.log( "-----------START---------\n",
                     "source: ", sourceName );
        while ( i < currentTargets.length ) { 
          console.log( currentTargets[i].stats.mean, "(" + currentTargets[i].name + ')' )
          i++;
github dkraczkowski / js.class / benchmark / class-mixins.js View on Github external
var JSClass = require('../src/js.class.js');
var Class = require('class');
var EEClass = require('ee-class');
var klass = require('klass');
var Benchmark = require('benchmark').Benchmark;
var suite = new Benchmark.Suite;

var EEAnimal = new EEClass({
    init: function(){},
    eat: function() {},
    sleep: function() {}
});

var JSCAnimal = JSClass({
    create: function() {},
    eat: function() {},
    sleep: function() {}
});

var CAnimal = Class.new(function(){
    this.class.eat = function(){};
    this.class.sleep = function(){};
github torworx / ovy / benchmark / simple.js View on Github external
var Benchmark = require('benchmark').Benchmark;
var ovy = require('../ovy');
var jsface = require('jsface');


var suite = new Benchmark.Suite('benchmark');


function test_ovy() {
    var Person = ovy.define('Person', {
        name: {type: String},
        email: {type: String},
        age: {type: Number},
        sex: {type: String}
    });

}


function test_javascript() {
    var Person = function() {
        this.$classname = 'Person';
github dkraczkowski / js.class / benchmark / class-extend.js View on Github external
var JSClass = require('../src/js.class.js');
var Class = require('class');
var EEClass = require('ee-class');
var klass = require('klass');
var Benchmark = require('benchmark').Benchmark;
var suite = new Benchmark.Suite;


var EEAnimal = new EEClass({
    init: function(){},
    eat: function() {},
    sleep: function() {}
});

var JSCAnimal = JSClass({
    create: function() {},
    eat: function() {},
    sleep: function() {}
});

var CAnimal = Class.new(function(){
    this.class.eat = function(){};