Skip to content

Commit

Permalink
benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Sep 21, 2018
1 parent 4554c2a commit a67410d
Show file tree
Hide file tree
Showing 24 changed files with 236,183 additions and 98 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ module.exports = {
"jest": true
},
rules: {
// https://github.com/airbnb/javascript/issues/1089

// https://stackoverflow.com/a/35637900/684957
// allow to add properties to arguments
"no-param-reassign": [2, { "props": false }]
"no-param-reassign": [2, { "props": false }],

// https://eslint.org/docs/rules/no-plusplus
// allows unary operators ++ and -- in the afterthought (final expression) of a for loop.
"allowForLoopAfterthoughts": true,
},
globals: {
BigInt: true,
}
};
27 changes: 27 additions & 0 deletions benchmarks/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const Benchmark = require('benchmark');

const suite = new Benchmark.Suite();

// add tests
suite.add('RegExp#test', function() {
/o/.test('Hello World!');
})
.add('String#indexOf', function() {
'Hello World!'.indexOf('o') > -1;
})
.add('String#match', function() {
!!'Hello World!'.match(/o/);
})
// add listeners
.on('start', function () {
console.log('starting tests');
})
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
console.log('Slowest is ' + this.filter('slowest').map('name'));
})
// run async
.run({ 'async': true });
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a67410d

Please sign in to comment.