source: imaps-frontend/node_modules/fastest-stable-stringify/benchmark/index.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 777 bytes
Line 
1'use strict';
2
3const Benchmark = require('benchmark');
4const suite = new Benchmark.Suite;
5const testData = require('./test.json');
6
7
8const stringifyPackages = {
9 // 'JSON.stringify': JSON.stringify,
10 'fastest-stable-stringify': require('../index'),
11 'fast-stable-stringify': true,
12 'fast-json-stable-stringify': true,
13 'faster-stable-stringify': true,
14 'json-stable-stringify': true,
15};
16
17
18for (const name in stringifyPackages) {
19 let func = stringifyPackages[name];
20 if (func === true) func = require(name);
21
22 suite.add(name, function() {
23 func(testData);
24 });
25}
26
27suite
28 .on('cycle', (event) => console.log(String(event.target)))
29 .on('complete', function () {
30 console.log('The fastest is ' + this.filter('fastest').map('name'));
31 })
32 .run({async: true});
Note: See TracBrowser for help on using the repository browser.