[Performance] Deep Copy vs JSON Stringify / JSON Parse
jarrodek opened this issue · comments
I've noticed a lot of places in the code that makes copy of an object by using JSON Stringify + JSON Parse. I have found a jsPerf that compares few technics for deep object cloning and this one is the slowest one: https://jsperf.com/deep-copy-vs-json-stringify-json-parse/5
You can increase performance when cloning JS objects by ~80% (according to my test result).
I see the clone function and recursiveDeepCopy function also use recursive. I think when the object is huge, the case of overflow stack will happen. So, should I consider this problem?
Note that raml-js-parser-2 has been deprecated, the new official parser is webapi-parser. Feel free to attempt to reproduce this issue with webapi-parser and report any issue you may have on that repository.
Moved to AMF parser already