deep-map-keys icon indicating copy to clipboard operation
deep-map-keys copied to clipboard

Circular reference handling has huge performance cost for huge geojson documents

Open ksuszka opened this issue 7 years ago • 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 [email protected]
$ node test.js
dmk: 757.423ms

$ npm i [email protected]
$ node test.js
dmk: 9302.293ms

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

ksuszka avatar Jan 10 '18 12:01 ksuszka