r/javascript • • Mar 20 '22

A real-world example of Improving JavaScript performance

https://www.the-koi.com/projects/an-practical-example-on-improving-javascript-performance/
51 Upvotes

11 comments sorted by

View all comments

12

u/Nullberri Mar 20 '22 edited Mar 21 '22

Seems like most of the article was "I used the wrong tool for the job and didn't understand my needs very well"

was there a way to design your setup without needing a circular reference? What if you really did need to deep clone because the values get modified later and need fresh copies? How would you have resolved the design choice?

What drove your design decision to use deepclone in the first place? was their originally a need that then dropped later?

1

u/No-Onion-8207 Mar 21 '22

Hi thanks for your great reply. Unfortunately I need this circular reference for some other features, but I did not need to deepClone my Object here. I also thought about that, but if I needed to do fresh copies I would have to refactor this features that relied on that reference or manually clone the object without its circular structure.

That’s why I wanted to write this article because I always preferred deep copy over shallow copy and did not thought about the memory and performance issues that could come from this simple call.