Various modules: stringify and parse json is slow
patmmccann opened this issue · comments
https://github.com/search?q=repo%3Aprebid%2FPrebid.js+json.parse%28json.stringify+path%3A%2F%5Emodules%5C%2F%2F&type=code is used by 17 modules. Several of these patterns can be improved similar to this example: InteractiveAdvertisingBureau/iabtcf-es#446
Reopening as we've had some success with the klona library we plan to commit
Cc @bbaresic
JSON.parse + JSON.stringify used to be the fastest way to deep clone objects. Apparently it still is.
We are probably deep cloning when it's not needed, but it's often not trivial to verify when it isn't, and I don't think it makes sense to go after the most responsible way to do it. In general premature optimization is a bad idea, it should be focused on known (= measured) bottlenecks.