Twitter | Pretraživanje | |
Mathias Bynens
🚀 For large JSON-compatible objects, JSON.parse is faster than JS object literals. ➡️ True for all browser JavaScript engines! ➡️ Speed-ups from 1.2× to 2× 🎥 My lightning talk explains why:
Reply Retweet Označi sa "sviđa mi se" More
nissy 25. stu
Odgovor korisniku/ci @mathias @v8js
Thank you for introducing Feedback is welcome from everyone 👍
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 25. stu
Odgovor korisniku/ci @nissy_nd @v8js
Thank you for creating the plugin!
Reply Retweet Označi sa "sviđa mi se"
Alexey Udivankin 26. stu
Odgovor korisniku/ci @mathias
Is there a jsperf (or similar repro) for that? Tried with ±200kb serialised redux state from real APP and JSON.parse appeared to be a bit (20% to none) slower. Also does this trick make sense when all the keys in object literal are quoted?
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 26. stu
Odgovor korisniku/ci @allx
Did you watch the video? We point to the benchmark on GitHub around the 04:58 mark:
Reply Retweet Označi sa "sviđa mi se"
Andrea Bogazzi 23. stu
Odgovor korisniku/ci @mathias
i tried a couple of time with my 2.8 megs json object did not manage to see an improvement in my flame graph. Every time someone tweets this i go and try again.
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 23. stu
Odgovor korisniku/ci @AndreaBogazzi
How are you measuring this exactly? Have you tried running our benchmark with your data?
Reply Retweet Označi sa "sviđa mi se"
Leonardo Cruz 23. stu
Odgovor korisniku/ci @mathias
That's Nice! Could I benefit of this on node/express receiving a massive payload in a post?
Reply Retweet Označi sa "sviđa mi se"
Andrea Bogazzi 25. stu
Odgovor korisniku/ci @llimacruz @mathias
I may be wrong but the payload from a request is already a string and express apps are probably just json-parsing it. So you are already done.
Reply Retweet Označi sa "sviđa mi se"
Rob Palmer 26. stu
Odgovor korisniku/ci @mathias
Does this JSON.parse optimization offer any benefit once code caching kicks in? It seems to reduce the large parse cost in favour of slightly greater execution cost. But when code caching, JS parsing is almost free, whereas execution cost still matters.
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 26. stu
Odgovor korisniku/ci @robpalmer2 @leszekswirski @tverwaes
Did you see the benchmark referenced in the talk? It includes warm load tests: cc for code caching insights specifically
Reply Retweet Označi sa "sviđa mi se"