I don't think a size limit is reasonable at all. According to the article a 500kB JS takes about 3-4MB of RAM once it's parsed. So having 500kB costs me a bit of parsing time and a handful of MB of RAM, both of which aren't really bottlenecks.
If there was some size limit X, then any SPA requiring more javascript would just be split up into modules that dynamically load and unload as they are needed. But that just makes the total instruction parsing time worse, for saving single-digit MBs of RAM.
If that does anything to the problem of slow javascript at all it makes it worse, because now I might have to wait for the right module to load and parse.
Correct me if I’m wrong, but I have a feeling what you describe could be prevented and that if you wanted to load/unload modules the sum of the JS could still be limited to a certain size
If there was some size limit X, then any SPA requiring more javascript would just be split up into modules that dynamically load and unload as they are needed. But that just makes the total instruction parsing time worse, for saving single-digit MBs of RAM.
If that does anything to the problem of slow javascript at all it makes it worse, because now I might have to wait for the right module to load and parse.