-
-
Save Joxit/32ccd5b5f63b474f30e707d804cbda25 to your computer and use it in GitHub Desktop.
pelias/parser WOF benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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