etc/benchmarks/js-serialization-libraries/index.js
function generateStats(schema, opts) {
  opts = opts || {};

  var type = avro.parse(schema, {wrapUnions: opts.wrapUnions});
  return [DecodeSuite, EncodeSuite].map(function (Suite) {
    var stats = [];
    var suite = new Suite(type, opts)
      .on('start', function () { console.error(Suite.key_ + ' ' + type); })
      .on('cycle', function (evt) { console.error('' + evt.target); })
      .run();
    stats.push({
      value: suite.getValue(),
      stats: suite.map(function (benchmark) {
        var stats = benchmark.stats;
        return {
          name: benchmark.name,
          mean: stats.mean,
          rme: stats.rme
        };
      })
    });
    return {name: Suite.key_, stats: stats};
  });
}
function generateStats(schema, opts) {
  opts = opts || {};

  var type = avro.parse(schema, {wrapUnions: opts.wrapUnions});
  return [DecodeSuite, EncodeSuite].map(function (Suite) {
    var stats = [];
    var suite = new Suite(type, opts)
      .on('start', function () { console.error(Suite.key_ + ' ' + type); })
      .on('cycle', function (evt) { console.error('' + evt.target); })
      .run();
    stats.push({
      value: suite.getValue(),
      stats: suite.map(function (benchmark) {
        var stats = benchmark.stats;
        return {
          name: benchmark.name,
          mean: stats.mean,
          rme: stats.rme
        };
      })
    });
    return {name: Suite.key_, stats: stats};
  });
}
function generateStats ( schema , opts ) { opts = opts || { } ; var type = avro . parse ( schema , { wrapUnions : opts . wrapUnions } ) ; return [ DecodeSuite , EncodeSuite ] . map ( function ( Suite ) { var stats = [ ] ; var suite = new Suite ( type , opts ) . on ( 'start' , function ( ) { console . error ( Suite . key_ + ' ' + type ) ; } ) . on ( 'cycle' , function ( evt ) { console . error ( '' + evt . target ) ; } ) . run ( ) ; stats . push ( { value : suite . getValue ( ) , stats : suite . map ( function ( benchmark ) { var stats = benchmark . stats ; return { name : benchmark . name , mean : stats . mean , rme : stats . rme } ; } ) } ) ; return { name : Suite . key_ , stats : stats } ; } ) ; }
Generate statistics for a given schema.
Generate statistics for a given schema .