Full Stack Web Performance

Get Started. It's Free
or sign up with your email address
Rocket clouds
Full Stack Web Performance by Mind Map: Full Stack Web Performance

1. AVOID DOM!

1.1. frame rate / painting

1.1.1. 1000ms / 60 Hz = ~16ms

1.1.1.1. pixels refresh on screen about 16ms

1.1.2. frames available from chrome dev tools

1.1.2.1. record circle button in timeline? view maybe, or profiles

1.1.3. if a button is clicked in the middle of a frame, if you aren't done processing before frame painting is planned, it skips the frame

1.1.3.1. this is called a dropped frame

1.1.3.2. you do "request animation frame" to get the full 16ms timeframe in order to prevent dropped frame

1.1.4. things that are "on scroll" should do this

1.1.5. do all your reads before all your writes so it's not mixed and you don't waste frame time once the first write occurs

1.1.6. chrome dev tools - show painted rectangles

1.1.7. layer promotion

1.1.7.1. transform: translateZ(0)

1.1.7.1.1. hack

1.1.7.2. <video>

1.1.7.3. <canvas

1.1.7.4. css opacity animations

1.1.7.5. transforms

1.1.7.6. new spec coming

1.1.7.6.1. will-change: position

1.1.7.6.2. will-change spec

1.1.7.6.3. stop hacking, start being intentional

1.1.8. enable continuous page repainting

1.1.8.1. shows how long to fully paint the screen while nothing special is running (but still needs to repaint)

1.1.8.2. example/demo

1.1.8.2.1. baseball cards were 14ms to just paint.

1.1.8.2.2. due to rounded edges with box shadow

1.1.9. CSS Triggers

1.1.9.1. styles -> which parts of painting is effected

1.1.9.2. rounded edges and drop shadows are very computational intensive

1.1.9.2.1. add shadows to images, not on the fly

2. Speaker

2.1. Nik Molnar

2.2. @Nikmd23

2.3. NYC

3. Why #perfmatters

3.1. people leave, even for half a second

3.2. User Needs

3.2.1. Functional ->

3.2.1.1. Reliable ->

3.2.1.1.1. Usable ->

4. Attack Plan

4.1. 1. Measurable Improvements

4.2. 2. Platform Stability

4.3. 3. Environment Neutrality

4.3.1. want environments to be equal

4.3.2. test dev prod, how they cache, cleanup cache, memory management

4.3.2.1. make them equal

4.4. 4. Scenario Focused

4.4.1. Application's aren't slow

4.4.2. Scenarios are slow

4.5. 5. Preset Goals

4.5.1. maybe not 2x faster

4.5.2. we will spend two sprints, or x points on performance

4.6. 6. Descending Granularity

5. Network

5.1. chrome dev tools

5.1.1. Size / Content

5.1.2. Copy all as HAR

5.1.2.1. "site is slow" in China

5.1.2.2. send me har file

5.1.2.3. online har viewer http://www.softwareishard.com/har/viewer/

5.1.3. Chrome audit tools

5.1.3.1. gzip images

5.2. compression

5.2.1. server side - turn on gzip compression

5.3. image compression

5.3.1. tiny png . com

5.4. image sprite

5.4.1. simple in visual studio

5.5. procastinate

5.5.1. script

5.5.1.1. async tag/attribute

5.5.2. img

5.5.2.1. lazyload attribute

5.5.2.1.1. ie11 only

5.5.2.1.2. puts lower priority on an image to load it latter

5.6. anticipate

5.6.1. <link rel="dns-prefetch"

5.6.1.1. load dns

5.6.2. <link rel="prefetch"

5.6.2.1. downloads asset

5.6.2.2. make sure it has caching headers, otherwise it WILL request it TWICE

5.6.3. <link rel="prerender"

5.6.3.1. opens hidden tab in browser, downloads page, js, and css

5.6.3.2. renders it, and swaps tabs

6. Server

6.1. Stay local

6.1.1. stay in process if possible

6.1.1.1. DB call

6.1.1.1.1. cache liberally

6.1.1.2. web service call

6.2. Iterate Less

6.2.1. lowering hit count is usually easier

6.3. Cache liberally

6.3.1. don't do work if you don't have to

6.4. Stream

6.4.1. loading lots of data at once is slow

6.5. Miscellaneous

6.5.1. Use string builder

6.5.2. exceptions should be exceptional

6.5.3. build in release mode

6.5.4. and many more

7. Compute

7.1. chrome profiler

7.1.1. stack trace

7.1.2. flame view

7.1.2.1. width of frame is how long it took to execute on a call stack

7.2. scope management

7.2.1. favor local vars

7.2.2. avoid with() statement

7.2.2.1. adds another scoping layer which means it's another scope table scan for anything outside of it

7.2.3. careful w/ closures

7.2.3.1. same as with()

7.3. looping

7.3.1. avoid for...in loops

8. Resources

8.1. Jank Free . Org

8.2. Books

8.2.1. High Performance Web Sites

8.2.2. Even Faster Web Sites

8.3. bit.ly/full-stack-web-perf