Exact timestamp here
Some stats about the size of JavaScript and Time To Interactive.
- Every 100kb of compress Jswe send to our users can lead to 3 - 4 increase in time to interactive on 3G mobile connections.
- Phone users experience slow first input delay on 7X more websites.
What's in a phone?
- Screen
- CPU
- Memory
- Battery
- Radio
But keep in mind.
Performance on the web is majorly impacted by the cost of
- Downloading JavaScript
- Executing downloaded JavaScript
They map directly to
- The Network
- Compute
Effective connection type across different regions
- Research from the Chrome team shows the difference in connection types across different locations
- Effective connection type for Twitter
- Effective connection type for Jumia
4G availability vs Speed
- The biggest bottleneck in web performance is CPU
Mobile devices have less CPU power and smaller battery power.
Mobile is a spectrum
Variety of devices with different specs
- Popular phones in Nigeria
- There's a huge difference between low-end and high-end devices
Everyone should have a great experience regardless of their devices.
Web performance on browsers
- The median webpage currently sends 360kbs (1mb uncompressed) of JavaScript which makes the average site interactive in 9s.
Metrics
- Interactivity impacts Rage clicks
A rage click is when a user clicks a page repeatedly, but it doesn't respond
- Rehydration is a compromise between server-side and client-side rendered JavaScript.
- JavaScript blocks the main thread, freezing the page
- Long tasks can block the main thread.
- It's great to get interactive in 5secs
- To be fast at JavaScript is to be fast at downloading, parsing, compiling and executing JavaScript.
- Reddit's JavaScript's story
- V8 starts streaming once its seen at least 30kb of JS, the rest are done in a worker thread.
- Improvements and additional worker threads in chrome 71+
- JavaScript processing times for Reddit.com
- JavaScript processing times for Facebook.com
- Main thread vs. background thread time spent parsing + compiling JS reddit.com (macbook pro)
- Main thread vs. background thread time spent parsing + compiling JS facebook.com (macbook pro)
A JavaScript Diet
JS parsing updates
- In the time it took Chrome 61 to parse FB's Js, Chrome 75 can now parse both FB's Js and 6 times Twitter's Js.
Minimize your JavaScript
- Code splitting
- Lazy loading in React
- Progressive Rehydration
Auditing JavaScript Regularly
- Webpack bundle analyzer
- Source map explorer
- Import cost from VS Code
- ES6 has this feature disallow large imports, giving a warning when importing specified modules.
Also
- Serve modern code to modern browsers [modern javascript]
- Less JavScript
Maintain Performance goals
- Performance Budgets
- Light Wallet
- Improving performance is a journey
The End