-
Web Performance Domination
because we can (and should?)
-
The problem
JavaScripts (when in great numbers) kill your website's load time!
-
Some history
2008: Steve Souders proposes async script loading (stevesouders.com)
-
Some more history
2010: Stoyan Stefanov proposes solution for pre-caching JavaScript without executing it (phpied.com)
-
The solution, in theory
- Pre-cache JavaScripts asynchronously
- Execute scripts in sequence (preferrably after window.onload)
- Scripts not blocking == fastness?
-
Today
Several libraries now exist to (almost) solve this:
-
That's great, but..
Why don't we just blindly load all JavaScripts asynchronously, execute them synchronously and call it a day?
-
Web sites are funny
If we execute scripts after load...
- Scripts will never hear load events
- Document.write will destroy the page if called late
- Besides destroying your page, Document.write has weird rules
-
DominateJS
- Started as fork of Steve Souders ControlJS
- Designed to "blindly" optimize ALL JavaScripts on page
- Goes all the way across the sky
-
Demo time
-
Load, DOMContentLoaded, readyState
DominateJS overrides native DOM methods to ensure that all 'load' handlers get fired eventually.
-
The document.write menace
We slapped a JavaScript HTML parser (github.com) on the top. Purrs like a toad.
-
Current status
- A lot of pages actually work great (and rez faster)!
- Learning a lot about the DOM (shudder)!
- Complex Google Ads almost working great ;)
-
Fork it on Github
Let's make the internet faster! (github.com)
-
Fin