Skip to content

Circular reference handling has huge performance cost for huge geojson documents #6

@ksuszka

Description

@ksuszka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions