Trying to get a feel for when to use Object.freeze. Any reason not to use it willy nilly whenever I want to pass around an immutable object? We also can enforce this in TypeScript afaik. More fast paths in v8 for operations on frozen objects perhaps?
-
-
-
The simple answer is: use it when it makes sense, i.e. whenever you need to enforce the immutability. I wouldn’t use it *only* to try and hit fast paths in any particular engine. As the blog post explains, we’re only just starting to add them.
- 1 more reply
New conversation -
-
-
I have a JSON bottleneck so this should be interesting to test sometime
-
Have a mostly done custom parser for a UInt8Array (saves on utf parsing prior to string parsing) but guuuuh
- 4 more replies
New conversation -
-
-
JSON.parse got better? I guess I need to re-evaluate / benchmark this again? (It was quite a bit faster to just split a 4mb string into an array than writing it out as a JS object) https://github.com/Narigo/reimemonster/blob/master/src/module/find-rhyme.mjs#L1-L2 …
-
For objects, JSON.parse('...') is faster to parse than the same data inlined as JS. Not sure how big the difference is for arrays specifically, but definitely worth measuring. Let me know what you find out! cc
@tverwaes - 1 more reply
New conversation -
-
-
woohoow, now I can finally copy objects again using JSON.parse(JSON.stringinfy(obj))!!!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
How is it possible to still improve performance on these things
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
JSON.parse
Frozen/sealed arrays