>> Facebook loads ~6MB of compressed JS across ~292 requests What a time to be alive.
The cost of parsing JSON
221–230 of 308 posts
Re: The cost of parsing JSON
#222I actually think the previous title of this article which was something about JSON.parse being faster than object instantiation or something like was clearer because in English the cost of something implies that it is a negative, whereas here the performance cost is a benefit relative to another solution with a higher cost. maybe I'm being picky though.
Re: The cost of parsing JSON
#223Earlier quoted context omitted.
JSON.parse won't parse a function call/literal. Direct injection would.
You're right about that, but I don't think you're following the argument. The argument was that there could be a `SimpleObject` that's limited and parses quicker. A `SimpleObject` wouldn't parse a function call, just like JSON.parse. As OP said, "subset of JS Objects". This subset of JS objects wouldn't support function calls.
Re: The cost of parsing JSON
#224Earlier quoted context omitted.
You're extrapolating quite a bit from a simple comment, which tells me that you'd probably be a poor manager as well. Then again, I'm extrapolating quite a bit as well. Seeing something like JSON.parse throughout the code is definitely a code smell and could decrease the maintainability of the codebase, and that's a very tangible problem. Obviously you shouldn't fire someone over something like this if it's the first…
"We apologize for the fault in the subtitles^Hjavascript. Those responsible have been sacked." "Those responsible for sacking the people who have just been sacked have been sacked" "The directors of the firm hired to continue the credits after the other people had been sacked, wish it to be known that they have just been sacked."
Re: The cost of parsing JSON
#225Re: The cost of parsing JSON
#226Earlier quoted context omitted.
Either way it's really more data than object at that point so it's appropriate to store it as JSON. Normally I'd place such data in a different file, but I can imagine that that might not be best for webpages.
> fata you created a noun to describe "fat data" from a typo.
Re: The cost of parsing JSON
#227Earlier quoted context omitted.
I've wondered about that with JSON.parse(JSON.stringify(obj)) being the fastest way to deep clone a plain JS object in any JS engine. It always looks dumb when it shows up, but it works well enough and I've seen it described as a best practice by some types of data manipulation libraries.
Would like to know this aswell. I know using spread const clone = {...source}; Is faster than object.assign({},source) And seeing as in this case the source is already a js object it would probably be slow to string and the parse.
Re: The cost of parsing JSON
#228If you're concerned enough about performance, or message passing costs are enough of an overall performance bottleneck, that parsing your messages even 1.7x as fast is worth changing the way you code, you probably shouldn't be using JSON as your message format in the first place.
Re: The cost of parsing JSON
#229Earlier quoted context omitted.
Thankfully most other developed country’s healthcare system doesn’t penalise individuals quite so significantly as the broken system you Americans keep voting for. I’m not saying the UK or other European counties have the perfect healthcare systems either but at least we aren’t tied to a job we don’t like because losing our company’s health scheme is too scary to consider.
If you're not paying for it with your money, then you have to pay with your time: public healthcare systems, like those in Europe are known for the long wait times for patients requiring surgery, or other costly procedures. Also, traveling to the US for treatment is still a thing, because new, advanced treatments are developed and first implemented in the US, so all that money spent give you something in return.
Sometimes it takes almost a year to resolve.
BTW, even basic surgeries in the US can have a price tag of close to $100k. I've had to fight off more than one ridiculous bill like this in the last 5 years. If you're talking about medical tourism coming into the US, I can't imagine you're talking about anything but very well off people.
Re: The cost of parsing JSON
#230I actually think the previous title of this article which was something about JSON.parse being faster than object instantiation or something like was clearer because in English the cost of something implies that it is a negative, whereas here the performance cost is a benefit relative to another solution with a higher cost. maybe I'm being picky though.
I was expecting something about the extent to which JSON processing in the world contributes to global warming or some such