Skip to content

Commit d6455ae

Browse files
committed
Improve tests
1 parent d3bbeef commit d6455ae

2 files changed

Lines changed: 105 additions & 51 deletions

File tree

test/index.bench.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,14 @@ function runSearchBenchmark() {
256256
"tags*:.tag+ and details.weight~:0-5",
257257
'(details.color*:^g or description:\"searchable content\" and not price~:0-100) or ("red" and not (age:45 or tags:golang)) or (tag2 and not (name:item))'
258258
]
259+
260+
const SearchEngine = require('../dist/npm/index.js').default
261+
const instance = new SearchEngine({ includeValuesInKeySearch: !false, excludeNumericStrings: !true })
259262

260263
// Implementations to benchmark
261264
const implementations = {
262-
"Original": search, // The original search implementation
265+
"Static": SearchEngine.search,
266+
"Constructor": instance.search.bind(instance)
263267

264268
// Add alternative implementations to compare:
265269
// "Alternative": alternativeSearch,
@@ -270,10 +274,9 @@ function runSearchBenchmark() {
270274
implementations,
271275
datasets: [smallDataset, largeDataset],
272276
queries,
273-
iterations: 300,
277+
iterations: 50,
274278
warmup: true
275279
})
276280
}
277281

278-
const { search } = require('../dist/npm/index.js')
279282
runSearchBenchmark()

0 commit comments

Comments
 (0)