What's the differences between rendering and painting event in Chrome DevTool Timeline View

前端 未结 3 814
孤独总比滥情好
孤独总比滥情好 2021-02-03 19:15

I think the render and paint just both mean rendering the page, show the DOM

What\'s the differences?

3条回答
  •  别那么骄傲
    2021-02-03 19:48

    Rendering events are about computing styles associated with each DOM node (i.e. "Style Recalculate") and elements position on the page ("Layout"). Paint category is about actually painting pixels and includes events like "Paint" itself and "Decode Image" / "Resize Image". In a nutshell, it's about inner structure vs. appearance -- if your page spends a lot of time rendering, this is because of the structure of its DOM and CSS (e.g. a large DOM tree), while significant paint times often mean the appearance of the page is affecting the performance (e.g. some styles are expensive to paint or an image is too large).

提交回复
热议问题