It is to my knowledge that with Javascript when you delete an entry on a object, at least with chrome it puts the object into "dictionary mode" or "slow mode"
Example:
var user = { name: 'connor', sex: 'male' };
// user is in "fast mode"
delete user.sex;
// user is in ("slow" or "dictionary") mode
When can this be beneficial and when can it be detrimental?
A specific case to go by would be, I have an object and when the application starts the object is empty, but as the code is run and the application memory builds up it can potentially become very large and the object will never decrease in size until the application closes by which it will not exist.
Also is there any semantics around this mode?
this article has some answers about how google's v8 handles object properties
the article confirms that there are such things as slow and fast properties
my guess is that if your property names change frequently the "Map" is a better way to go.
https://v8.dev/blog/fast-properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With