Optimising the front end for the browser

Sanjay Purswani on February 11, 2017

Optimisation is all about speed and satisfaction. For the User Experience (UX) we want our front end to deliver a fast... [Read Full]
markdown cheatsheet

Thank you for this very nice overview of web page rendering optimization. I only had some difficulty understanding 2 points:
1) the first graph under the § "How the browser renders the page": I don't understand why the JS scripts branch is grouped with the CSS branch. Why isn't it on its own separate branch?
2) I didn't quite grasp how layout is different from CSS? What do you mean by layout?
I also found this resource helpful: developers.google.com/web/fundamen...

Hi Olivier,

I'm really glad you enjoyed my article and thank you very much for your questions.

1) The diagrams are for illustration purposes and only a high level overview of what happens. I put scripts below CSS because scripts have to wait for prior CSS to download and compute, they do then act on the CSSOM and DOM.

2) CSS is the rules for the styles, it gets used to create the CSSOM which gets combined with the DOM to form the Render Tree. The phase after that is called Layout, in which the browser takes all the elements and decides what their dimensions are and where to put them.

I hope this answers your questions.

Fantastic write up Sanj! There's a great talk by one of my old colleagues about CSS and the critical path that's well worth a watch youtu.be/_0Fk85to6hA

Thank you Simon! I shall check that video out.

Really nice post, easy to understand even for a backend dev. Is the CRP metrics in dev tools or did you use an extension?

Someone just pointed out to me that Google's Lighthouse actually does give you critical metrics, along with a tonne of other useful optimisation stuff. It is actually more geared towards progressive web apps but useful nonetheless for what you're asking about.

Thanks Francois! CRP is a way to help you understand what is affecting your page rendering and how to optimise it. I don't think it appears in DevTools but there may be an extension out there.

Great arcticle!

Cheers Philipp!

Thank you Sanjay, Beautiful article, explained in the most lucid way possible...
Could you please write an article on 'flushing HTML'...ie. how in code, do we flush only the 'Above the Fold' HTML while in the second round trip fetch the remaining 'below the fold' and the entire document as a whole..
I mean is there any function in PHP or some Wordpress function that could do the same..
Advice on this would be really helpful, or could I just write the CSS and JS inline until I hit Below the fold and then start requesting external files, would that be helpful instead of some weird buffer concept of flushing?

Once again thank you Sanjay, It was really a beautiful article, eagerly waiting for the next one..

Hands down for this article

Thanks Tommaso!

Hi Sanjay,

Excellent article. Thank you.

Waiting for your next blog :).

Anil Pinto

Thanks Anil!

HI Sanjay, great article!

Greetings from Argentina.

code of conduct - report abuse