➤ Previously at KMK: liputan6.com, karir.com, vidio.com Contact ➤ Blog: kaklabs.com ➤ Twitter & IG: @kaklabs ➤ [email protected] Free Time ➤ Develop and maintain catetin.com Fun Facts ➤ Learn HTML & CSS because blogger’s template is bad ➤ Used to be Slackware fan boy
makes HTML parser from browser has to stop and execute it before it can continue parsing HTML ➤ Before optimization Vidio has 8 blocking JS requests and 2 blocking css
Is in the <head> of the document Does not have a defer or an async attribute in <head> or <body> ➤ A <link rel="stylesheet"> tag that: Does not have a disabled attribute. When this attribute is present, the browser does not download the stylesheet. Does not have a media attribute that matches the user's device ➤ A <link rel="import"> tag that: Does not have an async attribute.
the script is modular and does not rely on any scripts then use async. Example: Google Analytics script ➤ If the script relies upon or is relied upon by another script then use defer. ➤ Remove all inline scripts that depend on other scripts
library After Vidio has zero render-blocking JS, it only has effect to page load time, not start render time ➤ Remove unused HTML tag Faster download and DOM construction ➤ Remove Unused CSS Faster download and CSSOM construction
JS and CSS for public user and signed-in user. ➤ Less code, faster download and CSSOM construction ➤ Public User JS filename: application-<hash>.js CSS filename: application-<hash>.css ➤ Signed User JS filename: application_authenticated-<hash>.js CSS filename: application_authenticated-<hash>.css
+ TCP connection + SSL negotiation + Download time ➤ Combine multi files CSS No need to wait other CSS for rendering ➤ Combine multi files JS After Vidio has zero render-blocking JS, it only has effect to page load time, not start render time
the browser may not render any text pixels until it’s downloaded ➤ FontFaceObserver: Use default font first, when web font available, font will be replaced with web font ➤ Make FontFaceObserver loaded without render-blocking Pros: Faster start render Cons: User experience flash of unstyled text. Bad for UX.
characters from web font. Example character: ű Font Tools: https://github.com/fonttools/fonttools Font Forge: https://github.com/fontforge/fontforge This will reduce file size —> faster download But on bad internet connection user still experience flash of unstyled text ➤ Other Solution: Use System Font
on your computer ➤ No need to download font, faster start render. ➤ No Flash of Unstyled text, good UX. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”, sans-serif;
SSL negotiation ➤ HTTP/2: Only create one TCP Connection and SSL negotiation for every request ➤ No Need Domain Sharding anymore. Example: assets.example.com, assets2.example.com By default, web browsers limit the number between 4 - 8 of active connections for each domain. To work around this limitation developers use domain sharding.
the background ➤ Does not affect for first page ➤ Chrome & Firefox enables DNS prefetch by default ➤ Recently Akamai automatically create dns-prefetch, you don’t have to modify HTML Credit image: Ilya Grigorik
tool for improving the quality of web pages You can run it against any web page, public or requiring authentication It has audits for performance, progressive web apps, and more.