Design for Speed

Instead of endlessly optimizing code after it has been written we could treat the code as a design exercise. Great design embraces constraint.

So we need to think about what sort of comfortable requirements we might have to constrain our app. Often we hear customers won't wait longer than 2 seconds. Most people are mobile these days. Lets do some maths!

On a connection.
Make your customers wait seconds.

Your whole app needs to be Kilobytes or smaller.

You can have kb of HTML.
Room for kb of CSS.
Leaving enough space for kb of JS.
Even kb OTHER junk like images, videos, svg, etc.

Note! This does not consider how long the device will take to parse, then execute, the payload. This only considers the network threshold. Normally we hear about time to the first byte but our customer actually cares about a running app not an app that just began to download.