Dedicated to Vitaly HarisovAfter translating the note
“Optimizing CSS Performance” and fair comments by Vitaly
vithar , I decided to run a series of experiments on the speed of the CSS selectors of the internal browser engine. The results were very funny, and in some places, perhaps even interesting.
The technique. File size
')
Naturally, the speed of a single CSS-rule is very high, and even tens and hundreds of them should not noticeably slow down browsers. Therefore, it is necessary to set up an experiment on working with several thousand rules, otherwise the accuracy of the results will be very low. Using JavaScript to generate HTML / CSS code does not seem reasonable, because then you have to take into account the speed of the JS engine in browsers, as a result, the experiment will not be clean enough.
In the end, it was decided to generate static files (about 300Kb), which will contain a sufficient number of different CSS selectors. This most “sufficient” number was selected by several parameters, including: file size (it was not desirable to drive several MB through the browser and the Internet) and the speed of HTML / CSS code in browsers (it should be low enough so that the files are multiple hundreds of KB already noticeably slowed down when opening).
read further on webo.in →