Skip to content

Instantly share code, notes, and snippets.

@Joxit
Created May 13, 2019 14:26
Show Gist options
  • Save Joxit/32ccd5b5f63b474f30e707d804cbda25 to your computer and use it in GitHub Desktop.
Save Joxit/32ccd5b5f63b474f30e707d804cbda25 to your computer and use it in GitHub Desktop.
pelias/parser WOF benchmark
const whosonfirst = require('./resources/whosonfirst/whosonfirst')
const fs = require('fs')
const FST = require('./tokenization/FST')
const set = new FST()
whosonfirst.load(set, ['locality'], ['name:eng_x_preferred.txt', 'name:fra_x_preferred.txt'])
const used = process.memoryUsage().heapUsed / 1024 / 1024;
console.log(process.memoryUsage(), `${used}MB`)
let start = new Date()
new Array(100).fill().forEach(e => fs.readFileSync('./resources/whosonfirst/dictionaries/locality/name:eng_x_preferred.txt', 'utf8')
.split('\n')
.map(row => {
return row.split('|').map(e => { set.has(e)})
}))
console.log(process.memoryUsage(), `${used}MB`, new Date() - start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment