Skip to content

Allow disabling startup_css for speedtest comparison

Simon Knox requested to merge psi-no-start into master

What does this MR do and why?

Perf test first tried in gitlab-org/frontend/rfcs#92 (comment 1170201514). Now you can add ?no_startup_css to a URL to disable startup CSS.

To minimize changes, it disables the stylesheet_link_tag_defer method, and the startup_css_activation script block (which adds data-startupcss attribute to the stylesheets).

waitForCSSLoaded in startup_css_helper.js still gets loaded, but it will just run & resolve straight away, so I figured it wasn't worth making any changes there.

Screenshots or screen recordings

How to set up and validate locally

  1. Load pages and confirm I didn't break anything
  2. Load pages with ?no_startup_css query param (it doesn't need a value, just to be present)

When startup CSS is disabled, there should be one less style block in the HTML response for a page. You can confirm that by running this in devtools console document.querySelectorAll('style').forEach(style => console.log(style.innerHTML.length)) (startup CSS is the big one)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Simon Knox

Merge request reports

Loading