Is there a max javascript filesize, what can browsers handle?
Asked Answered
C

1

10

Engineering incredibly large webapps, do we have any top or limit or best practice for filesizes in these large projects? The biggest I have seen is probably twitter/gmail which had around 1mb (Minified) javascript - but how much can a browser handle?

What if there is a large app with 5mb, 10mb or 100mb javascript minified? When does it severely affect performance or memory usage (Even if the app is very well written and optimized) - can the jit handler take whatever? Are there any diminishing returns?

Is there any real example of apps beeing this big, except for the usual suspects such as gmail, twitter, facebook, googledocs, etc.

Thanks!

Checkbook answered 12/4, 2013 at 11:19 Comment(0)
P
6

As far as I know there is now such limit for JavaScript files, nor is there a limit at all for files of all kinds.

The only limit is the system you are running the web app on:

The browser will consume as much CPU and RAM as it needs to handle your web app. The internet connection is a bottleneck, too.

Although a web application can grow to a quite big size, there is no such real (productive used) example of an application serving JavaScript files up to 100 MB in size - I mean, think about it, 100 MB size for a JavaScript file (!), nobody would visit the page, stay on the page and wait till the download of the JavaScript files is finished and the browser's JavaScript engine processed this file.

But feel free to try write a JavaScript file which is 100 MB in size which does several tasks such as doing a console.log() a thousand times and report it here to us what happened then.


Some nostalgy: I found this bug report from Mozilla, it's nearly 13 years old.

Purine answered 12/4, 2013 at 11:42 Comment(4)
"nor is there a limit at all for files of all kinds.". For your knowledge: blogs.telerik.com/aspnetmvcteam/posts/10-05-03/… and joshua.perina.com/africa/gambia/fajara/post/… - There are limits for CSS: Size, Selectors and # of files.Hayrack
That CSS limit is a real bitch, we had discovered this IE limitation a couple years back, we had to LITERALLY import ALL the css rules for one of our products into javascript, that was a fun night...Slavism
Ah yep, i had the issue with IE8 css file size restriction too. It doesn't processed file content starting from part that exceed 150kb. Was trying to understand why some styles not applied.Aguirre
An interesting use case is when you want to store a dataset in a javascript file, and let the user process that data in the browser. In those cases a javascript of 100 MB is not at all strange. Here is one of 50 MB, and it loads quickly: annotation.github.io/app-nena/phono.htmlOriole

© 2022 - 2024 — McMap. All rights reserved.