Re:The Cost of JavaScript in 2019
by czechdeveloper on Sunday June 30, 2019 @11:22AM
(#20318668)
It make sense if you think about it, but I would really not figure it out myself, that is true.
[ Parent
| on HN ]
Re:The Cost of JavaScript in 2019
by mordechai9000 on Sunday June 30, 2019 @12:36PM
(#20319016)
I read the comments before the article, and it took me a minute to figure out why: Of course, JSON is much simpler to parse than JS.
For anything large enough to matter, I think you'd want to deliver it as an application/json blob, anyway. Or use protobuf.
indeed! and i was going to say the same thing. it makes perfect sense if you are a programmer with a basic understanding of how languages work. but like someone else said, i would not have thought about it first thing when writing code.
Perhaps the reason many (like myself) did not immediately expect the speedup is that they started on or are still using another non-scripting programming languages.
There, the language parsing penalty is paid during the compile step, and as far as a user is concerned the object approach is obviously faster than parsing from JSON.
This does leave me wandering - is the result here applicable to other scripting languages too? The argument in the article would seem to apply in the general case, but perhaps other languages have some particularities that change the result.