|
|
|
Why don't modern browsers include precompiled js libraries?
|
|
9 points
by seanica
5228 days ago
|
|
For example, Google recommend using their CDN for a range of js libraries
Why doesn't Chrome include these libs as precompiled scripts?
On detecting a request for a script hosted on Google CDN, Chrome could check it's precompiled cache first and use it if available.
For specific js libraries, this would eliminate some aspects of Sam Saffron's "The jQuery Tax". The release cycles of stable versions of jQuery, jQueryUI, et al, seem to be longer than release cycles of Chrome & Firefox patches, so it kinda seems practical. The only issue I can think of right now is potential js library bugs & vulnerabilities being 'baked into the browser'. However I'm pretty sure things like this can be solved.
The first thing that comes to mind is it would be treated like any regular browser bug/vulnerability. Are there any enlightened browser hackers that can explain why this is a bad idea? |
|
2. JS files that get a certain number of uses get marked for compilation.
3. On browser startup, the marked files are recompiled into the binary.
4. The modules are pulled in when the browser detects an HTTP requested file matches an existing file.
MD5 hashing couldn't be used, due to collision vulnerabilities!
I guess the question is whether the browser's JITter is already as fast as compiling javascript into the binary.