Skip to content

Commit

Permalink
Add benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 28, 2019
1 parent b97a585 commit fca18f6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
35 changes: 33 additions & 2 deletions benchmarks/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
import cartesianProduct from 'cartesian-product'
import cartesian from 'cartesian'
import lodash from 'lodash'
// eslint-disable-next-line import/no-unassigned-import
import 'lodash.product'

import fastCartesian from '../src/main.js'

import { benchmark } from './benchmark.js'
import { variants } from './variants.js'

const testCartesian = { title: 'test-cartesian', main: fastCartesian, variants }
const testFastCartesian = {
title: 'fast-cartesian',
main: (...args) => fastCartesian(...args),
variants,
}

const testCartesianProduct = {
title: 'cartesian-product',
main: (...args) => cartesianProduct(args),
variants,
}

const testCartesian = {
title: 'cartesian',
main: (...args) => cartesian(args),
variants,
}

const testLodashProduct = {
title: 'lodash.product',
main: (...args) => lodash.product(...args),
variants,
}

benchmark({ testCartesian }, { repeat: 1e2 })
benchmark(
{ testFastCartesian, testCartesianProduct, testCartesian, testLodashProduct },
{ repeat: 1e2 },
)
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@
},
"devDependencies": {
"ava": "^1.4.1",
"cartesian": "^1.0.1",
"cartesian-product": "^2.1.2",
"gulp": "^4.0.2",
"gulp-shared-tasks": "^0.28.2",
"husky": "^2.3.0"
"husky": "^2.3.0",
"lodash": "^4.17.11",
"lodash.product": "^18.9.19"
},
"engines": {
"node": ">=8.12.0"
Expand Down

0 comments on commit fca18f6

Please sign in to comment.