forked from datagouv/api-geo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbench.js
More file actions
29 lines (25 loc) · 751 Bytes
/
bench.js
File metadata and controls
29 lines (25 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const Benchmark = require('benchmark')
const debug = require('debug')('bench')
debug('will load database')
const db = require('./lib/communes').getIndexedDb()
debug('database loaded')
const suite = new Benchmark.Suite()
suite
.add('spatial search (point)', () => {
db.search({pointInContour: [6.175882816314696, 49.11830706404367]})
})
.add('text search', () => {
db.search({nom: 'metz'})
})
.add('CP search', () => {
db.search({codePostal: '54490'})
})
.on('cycle', event => {
debug(String(event.target))
})
.on('complete', function () {
debug('Fastest is %s', this.filter('fastest').map('name'))
debug('Memory usage: %s', JSON.stringify(process.memoryUsage()))
})
// Run async
.run({async: true})