Menu

Our homepage composites 14 layers and repaints 876 times in 20 idle seconds, and 696 of those are the demo that types
📰

Our homepage composites 14 layers and repaints 876 times in 20 idle seconds, and 696 of those are the demo that types

DEV Community: css·Daniel Pertu·6 days ago
#AU9borxy
#devtocss#devto#dev#layer#pages
Long article (1053 words) — no AI summary yet.
Reading 0:00
15s threshold

notifio.app is 38 pages of mostly text, with four animated product mockups on the homepage. I have measured those mockups from the CPU side before, where they cost about 7.4 seconds of main thread per minute, forever . This is the same animations seen by the compositor instead, which turned out to rank them in the opposite order.

I did this once before on a sibling site, where a static FAQ page runs on 10 compositing layers . That post read one page. This one reads 38 and then watches them do nothing for 20 seconds.

Reading the layer tree

LayerTree is a CDP domain, and the tree is pushed as an event rather than fetched, only when it changes. So you have to enable it, make something change, and keep the last event:

const cdp = await ctx . newCDPSession ( page ) ; cdp . on ( 'LayerTree.layerTreeDidChange' , ( e ) => { if ( e . layers ) latest = e . layers ; } ) ; await cdp . send ( 'LayerTree.enable' ) ; await page . goto ( url ) ; await page .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.