Skip to content

Instantly share code, notes, and snippets.

@bjesus
Last active June 10, 2022 20:40
Show Gist options
  • Save bjesus/79a94baae0df6fe1308ef454c99bd55e to your computer and use it in GitHub Desktop.
Save bjesus/79a94baae0df6fe1308ef454c99bd55e to your computer and use it in GitHub Desktop.
My browser isn't your lab, do you tests elsewhere - turning off the Performance Web API

RUM testing is inherently flawed

Everyone wants their website to be fast. For many years, we had synthetic tests: you spin up some automated browser, load your site, measure, done. It's not perfect, but it's a pretty good indicator for how fast your website is. You can simulate slow networks. You can run this automated browser on a different continent. It offers some flexibility.

But then someone convinced us all that it isn’t enough. You have to actually measure the peformance in the browsers of your users. RUM came into the world. From MDN:

Real User Monitoring or RUM measures the performance of a page from real users' machines. Generally, a third party script injects a script on each page to measure and report back on page load data for every request made. This technique monitors an application's actual user interactions. In real user monitoring, the browsers of real users report back performance metrics experienced.

Strange, isn't it? You would think that if one wants a faster website they’d maybe try to remove some JavaScript code from it, or to have the browser make less network requests. You would think that browsers would not add functionality that slows websites down if it provides no benefits to the user. But suddenly people that wanted their website to be fast started injecting JavaScript code to their websites, and that JavaScript made the browser connect to some additional servers with additional requests. We’re literally measuring websites performance by slowing them down. Browsers joined the party and added more and more metrics and capabilities to the Performance Web API.

When you visit a website, you get nothing from your browser collecting and reporting performance data - nothing except a slightly slower website. This gist is meant to collect ways to disable the Performance Web API, because your browser isn’t a testing lab. No other Web APIs are completely designed to provide functionality for the benefit of someone who isn't the end user, and if they do exist, users should be able to turn them off too.

Many great people working on RUM tools. They're not evil of course and they really want a faster web. But a browser is meant to be the user's agent. It should optimize for the user's experience, and when it’s questionable it should at least give the user the choice.

Use about:config to set the following to false:

  • dom.enable_performance
  • dom.enable_performance_navigation_timing
  • dom.enable_performance_observer
  • dom.enable_resource_timing
  • dom.enable_event_timing

I couldn't find a way to disable PerformancePaintTiming, or to completely remove the performance object.

It seems impossible to disable the Performance Web API in Chromium based browsers.

Opinions are my own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment