Skip to content

Commit

Permalink
adapt benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaong committed Sep 18, 2020
1 parent 4589b3b commit 0a654b1
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
/dist
/examples/dist
/examples/node_modules
/benchmarks/dist
/coverage
yarn-error.log
2 changes: 1 addition & 1 deletion benchmarks/autoSuggestion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch as ms } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Auto suggestion')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/combinedSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch as ms } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Combined search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/exactSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Exact search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fuzzySearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Fuzzy search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/indexing.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import MiniSearch from '../src/MiniSearch.js'
import { lines } from './divinaCommedia.js'

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/loadIndex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import MiniSearch from '../src/MiniSearch.js'
import { miniSearch as ms } from './divinaCommedia.js'

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/prefixSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Prefix search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/searchFiltering.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Search filtering')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"test": "jest",
"test-watch": "jest --watch",
"coverage": "jest --coverage",
"benchmark": "NODE_ENV=production BABEL_OUTPUT=commonjs babel-node --expose-gc benchmarks/index.js",
"benchmark": "BENCHMARKS=true yarn build && NODE_ENV=production node --expose-gc benchmarks/dist/index.js",
"build": "yarn build-typedef && NODE_ENV=production rollup -c",
"build-minified": "MINIFY=true yarn build",
"build-docs": "jsdoc --configure jsdoc.json",
Expand Down
16 changes: 14 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,20 @@ const config = ({ format, output, name, dir }) => ({
plugins: [typescript()]
})

export default [
const benchmarks = {
input: 'benchmarks/index.js',
output: {
sourcemap: false,
dir: 'benchmarks/dist',
format: 'commonjs',
entryFileNames: '[name].js',
plugins: []
},
plugins: [typescript()]
}

export default process.env.BENCHMARKS === 'true' ? [benchmarks] : [
config({ format: 'es', output: 'es6' }),
config({ format: 'es', output: 'es5m', dir: 'es5m' }),
config({ format: 'umd', output: 'es5m', name: 'MiniSearch' })
config({ format: 'umd', output: 'es5m', name: 'MiniSearch' }),
]

0 comments on commit 0a654b1

Please sign in to comment.