Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow rasterization in Dev Tools

I'm optimising a site with some fairly simple parallax scrolling. The animated elements are on separate layers (backface-visibility:hidden) and the scripting and rendering steps seem fairly quick. However I'm seeing a lot of time spent on painting:

Chrome Dev Tools screen grab

The actual drawing is fine but those huge hollow green bars represent rasterization in the separate compositor thread.

Here's the link

What am I doing to cause that and how can I improve it?

like image 663
Tamlyn Avatar asked Feb 24 '15 16:02

Tamlyn


People also ask

How do I enable flashing in Chrome?

Chrome DevTools Paint flashingPress Command+Shift+P (Mac) or Control+Shift+P (Windows, Linux) to open the Command Menu. Start typing Rendering in the Command Menu and select Show Rendering. In the Rendering tab enable Paint flashing.

How do I find render mode in Chrome?

# Open the Rendering tabPress Command + Shift + P (Mac) or Control + Shift + P (Windows, Linux, ChromeOS) to open the Command Menu. Start typing rendering , select Show Rendering, and press Enter .

What is rasterize paint?

you may hear the term "rasterize" used in conjunction with paint. This is because painting is actually two tasks: 1) creating a list of draw calls, and 2) filling in the pixels. The latter is called "rasterization" and so whenever you see paint records in DevTools, you should think of it as including rasterization.


1 Answers

Okay, I can repro the hollow bars.

enter image description here

They are happening on the compositor thread, that's why we do them hollow. you can see it more clearly flicking to the flame chart:

enter image description here

Then if you recorded the timeline with the Paint checkbox checked you can see exactly what was inside each paint.

enter image description here

And we can then use the slider to narrow down which draw calls are the most expensive part of these big paints:

enter image description here

(looks like a big cliprect and then the bitmap draw)

But looking in aggregate.. it appears that you're repainting the world in every frame.

You might want to look at what's happening in each frame... especially to your layers:

enter image description here

HOWEVER.

After all that, it appears you can solve your issues with animating transform:translate() instead of left/top. I would also recommend adding will-change:transform to those items. This will allow the browser to move items around without repainting and you shouldn't have to reraster on each frame.

must reads:

  • Animations and Performance - web fundamentals
  • High Performance Animations - html5rocks

Cheers

like image 164
Paul Irish Avatar answered Oct 03 '22 21:10

Paul Irish