tcorral/JSONC

Serious performance issues

andreasanta opened this issue · 0 comments

I attempted the compression of objects with more than 5k key->value pairs, and the use of arrays and several iterations slows down the processing terribly.

I would suggest to optimize:

  • contains, use object instead of array
  • unique, same as above, just stick all the keys into an object and then Object.keys()
  • _getKeys, use === undefined instead of hasOwnProperty (line 149)
  • _compressOther, do not use json.parse/stringify, replace the key names in place without going over the whole string

I wanted to use this for a huge number of objects, but it keeps my node cli running forever with just over 4k keys in my object.