I've created two files, each with 100,000 div elements. The first is slow.html:
<div>0.8562158266079849</div>
<div>0.9135280673563708</div>
...
<div>0.5053808333117775</div>
<div>0.9188260452433614</div>
and the second is fast.html:
<style>
div {
content-visibility:auto;
contain-intrinsic-size: 100vw 18.5px;
}
</style>
<div>0.8562158266079849</div>
<div>0.9135280673563708</div>
...
<div>0.5053808333117775</div>
<div>0.9188260452433614</div>
As you can see, each div is just filled with a random decimal number. The only difference between slow.html and fast.html is that fast.html has that <style> block at the top.
slow.html takes about 2.7s to load:
and fast.html takes about 17s to load:
So content-visibility:auto has slowed down page load by quite a bit rather than speeding it up. Am I misunderstanding and/or misusing content-visibility? Is it not designed for the situation where I've got a large number of very simple elements?
My intended use-case is for helping speed up the rendering of tables of content where it's not worth it to implement virtual scrolling because they're just quick/scrappy/throwaway tools for internal analytics use.
I have tested on Chrome v89 and v90. Both have roughly the same load times.
Here's a one-liner to help you quickly replicate this:
new Array(50000).fill(0).map(_ =>`<div>${Math.random()}</div>`).join("\n")
Note that using content-visibility and contain-intrinsic-size has worked as expected (massively reduces rendering time) in my previous tests, but it strangely doesn't work in this minimal example.

