mcmath/deep-map-keys

Circular reference handling has huge performance cost for huge geojson documents

Opened this issue · 0 comments

deep-map-keys has slow performance on geojson documents with long list of coordinates. Example which shows the issue:

// test.js
_ = require('lodash');
dmk = require('deep-map-keys');

// Simulate huge geojson document
doc = _.range(1000000).map(r => [r, r]);

console.time('dmk');
dmk(doc, x => x);
console.timeEnd('dmk');
$ npm i deep-map-keys@1.1.0
$ node test.js
dmk: 757.423ms

$ npm i deep-map-keys@1.2.0
$ node test.js
dmk: 9302.293ms

My suggestion would be to add an option to disable circular reference handling.