4 ms·
Can you expand on what you said about the `delete` keyword implications with the GC? I've never heard of that issue.
by xtrumanx 11y ago
Can you expand on what you said about the `delete` keyword implications with the GC? I've never heard of that issue.
- Touche 11y agoI haven't either, only that delete will cause code to be de-optimized.
- chris_wot 11y agoI think it affected earlier versions of IE - Douglas Crockford detailed an issue here: http://javascript.crockford.com/memory/leak.html http://javascript.crockford.com/memory/leak.html
- chris_wot 11y agoWhat the hell is wrong with people today? I was hazarding a guess what was being referred to and I get down voted?
- CrystalGamma 11y agoIts main purpose is deleting a property from an object, which is a pretty slow operation on modern JS engines. Unless some code tests for the existence of a property, setting it to null is a better idea.
- tracker1 11y agoI'd suggest undefined over null if you want to effectively remove a property, since JSON.stringify won't serialize those properties... in an array, it will become null. Though, I don't use delete much, I honestly don't worry about it much. In most contexts it's a bit of a premature optimization unless you are in a very low-level tool that will be used for example gaming, video or photo manipulation, there are probably better optimizations to make.