Why do you think that Javascript or python implementations are non-optimized?
To determine the cost of creating a new object (generally by allocating memory) on a given implementation, use a profiler.
Now compare it with the cost of extending an existing object (generally by ... allocating memory) on a given implementation, using a profiler.
In many cases you'll find that creating new objects is more cache friendly than extending sprawling trees, but ymmv.
In the end, the answer remains ... for performance, profile.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why do you think that Javascript or python implementations are non-optimized?
To determine the cost of creating a new object (generally by allocating memory) on a given implementation, use a profiler.
Now compare it with the cost of extending an existing object (generally by ... allocating memory) on a given implementation, using a profiler.
In many cases you'll find that creating new objects is more cache friendly than extending sprawling trees, but ymmv.
In the end, the answer remains ... for performance, profile.