emotion-site-optimization.md

December 30, 2017 ยท View on GitHub

Experiment: how much faster you can make emotion website.

Let's set expectations upfront. I do not suggest to switch to one technology over another. I use real-life measurement metrics and minimal example. The purpose is to show that you can get a lot of performance improvement, with a small investment of your time, it is not hard at all. You do not need Ph.D. to do this.

Setup:

  • All measurements were done using webpagetest with following settings: "From: Dulles, VA - Moto G4 - Chrome - 3G".
  • Most measurements were done against firebase, but still, there is variation in Time To the First Byte from 1.3s to 1.7s. This is because of network fluctuations, it is out of experiment scope. Apply correlation accordingly.
  • Code for experiments are stored in stereobooster/emotion#react-snap
  • Each step is stored in the separate tag. To test it, do the following:
git clone https://github.com/stereobooster/emotion.git
cd emotion
git checkout round-N
yarn install
yarn build:site

Round 0

git checkout round-0

emotion-0-filmstrip.png

Load TimeFirst ByteStart RenderSpeed IndexFirst Interactive (beta)TimeRequestsBytes InTimeRequestsBytes InCost
59.639s1.350s9.525s967614.866s59.639s69,084 KB61.694s89,113 KB$$$$$

emotion-0-waterfall.png

emotion-0-waterfall-full.png

Round 1

git checkout round-1

Add react-snap. No configurations!

emotion-1-filmstrip.png

Load TimeFirst ByteStart RenderSpeed IndexFirst Interactive (beta)TimeRequestsBytes InTimeRequestsBytes InCost
49.870s1.473s4.072s438415.375s49.870s69,144 KB51.388s89,174 KB$$$$$

emotion-1-waterfall.png

Round 2

git checkout round-2

Use "inlineCss": true.

emotion-2-filmstrip.png

Load TimeFirst ByteStart RenderSpeed IndexFirst Interactive (beta)TimeRequestsBytes InTimeRequestsBytes InCost
53.369s1.331s1.777s220814.237s53.369s69,210 KB54.875s89,242 KB$$$$$

emotion-2-waterfall.png

Round 3

git checkout round-3

Use Link headers.

emotion-3-filmstrip.png

Load TimeFirst ByteStart RenderSpeed IndexFirst Interactive (beta)TimeRequestsBytes InTimeRequestsBytes InCost
54.145s1.472s1.886s260313.238s54.145s69,020 KB56.609s109,918 KB$$$$$

emotion-3-waterfall.png

Next steps

  • replace gif with mp4
  • postpone download of gif until needed (play button)
  • optimize font loading strategy
  • optimize image and/or use a smaller size