Oh just parse that 5MB of JS to 20MB of used memory for the code (after spiking even higher), then actually run it and oh my it allocates another 20MB for god knows what, and we're gonna need like 5 representations or outright copies of every "component" on the page sitting around in memory somewhere, you know, in the name of being "performant" and having good "Developer Experience" so now it's nearing 150MB of memory total. Oh and we need instant updates from the server (narrator: no, they didn't) so let's have some web sockets eat a bit more memory and a few processor cycles (so, battery) here and there even when the user's not on the page. Oh and everything needs to be immutable because it's impossible to write good code otherwise, so of course we imported libraries for that (how do you think we got to 5MB, if not importing shitloads of libraries of dubious value? LOL it's not like our "app" actually does very much) and since Javascript's not designed for it we're gonna really give that garbage collector a workout for no good reason.
Great, now that that's sorted out: let's download a few MB of JSON, then parse that into Javascript data structure (more memory spikes), copy and slightly modify that about three times in different places, then use it to create a few representations of a "component" one of which will be a set of actual entries in the DOM. And we'll keep most of that around after we're done.
Great, now that that's sorted out: let's download a few MB of JSON, then parse that into Javascript data structure (more memory spikes), copy and slightly modify that about three times in different places, then use it to create a few representations of a "component" one of which will be a set of actual entries in the DOM. And we'll keep most of that around after we're done.