sitespeedio / sitespeedio/sitespeed.io

CPU measurements seem not to reset between measurements (scripting)

Open
#4,329 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
5k
Forks
624
Avg merge
4h 8m
Merged PRs (30d)
2

Description

Have you read the documentation?
URL

https://www.builder.io/

What are you trying to accomplish

I'm trying to measure CPU power consumption of non-cached and cached pages. When I run the measurement three times (first non-cached and then twice cached), the CPU numbers are as follows:

0.0035 µWh
0.005 µWh
0.0057 µWh

The values are constantly rising, while the two latter runs are identical (and should be less heavy compared to the first one)

What browser did you use?

Firefox

How to reproduce
sitespeed.io -b firefox -n 1 --firefox.geckoProfiler --firefox.geckoProfilerParams.features "power" --firefox.powerConsumption builder-qwik.mjs --multi 

builder-qwik.mjs:

/**
 * @param {import('browsertime').BrowsertimeContext} context
 * @param {import('browsertime').BrowsertimeCommands} commands
 */
export default async function (context, commands) {
  const delayTime = 500;
 
  await commands.measure.start('Non-cached');
  await commands.navigate('https://www.builder.io/');
  try {
    await commands.click.byId('onetrust-accept-btn-handler');
  }
  catch(e) {
  }
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.toBottom(delayTime);
  await commands.measure.stop();
  
  await commands.measure.start('Cached');
  await commands.navigate('https://www.builder.io/');
  try {
    await commands.click.byId('onetrust-accept-btn-handler');
  }
  catch(e) {
  }
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.toBottom(delayTime);
  await commands.measure.stop();
  
  await commands.measure.start('Cached 2');
  await commands.navigate('https://www.builder.io/');
  try {
    await commands.click.byId('onetrust-accept-btn-handler');
  }
  catch(e) {
  }
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.byPages(1);
  await commands.wait.byTime(delayTime);
  await commands.scroll.toBottom(delayTime);
  return commands.measure.stop();
};
Log output
[2024-12-01 15:18:54] INFO: Versions OS: darwin 23.6.0 nodejs: v20.11.0 sitespeed.io: 35.6.1 browsertime: 23.4.1 coach: 8.0.2
[2024-12-01 15:18:55] INFO: Running tests using Firefox - 1 iteration(s)
[2024-12-01 15:18:56] INFO: Start to measure Non-cached
[2024-12-01 15:18:56] INFO: Start GeckoProfiler with features: ["power"] and threads: ["GeckoMain","Compositor","Renderer"]
[2024-12-01 15:18:59] INFO: Navigating to url https://www.builder.io/ iteration 1
[2024-12-01 15:19:15] INFO: Collecting Gecko profile from /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Non-cached/data/geckoProfile-1.json to /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Non-cached/data/geckoProfile-1.json
[2024-12-01 15:19:15] INFO: Stop GeckoProfiler.
[2024-12-01 15:19:15] INFO: Collecting CPU power consumtion
[2024-12-01 15:19:15] INFO: Gzip file the profile.
[2024-12-01 15:19:15] INFO: Done stopping GeckoProfiler.
[2024-12-01 15:19:15] INFO: CPU / Power usage: 8408
[2024-12-01 15:19:15] INFO: Take after page complete check screenshot
[2024-12-01 15:19:16] INFO: Take largest contentful paint screenshot
[2024-12-01 15:19:16] INFO: Start to measure Cached
[2024-12-01 15:19:16] INFO: Start GeckoProfiler with features: ["power"] and threads: ["GeckoMain","Compositor","Renderer"]
[2024-12-01 15:19:19] INFO: Navigating to url https://www.builder.io/ iteration 1
[2024-12-01 15:19:25] ERROR: Couldn't execute script named CUSTOM error:JavascriptError: TypeError: document.getElementById(...) is null
[2024-12-01 15:19:25] ERROR: Could not find element by id onetrust-accept-btn-handler
[2024-12-01 15:19:34] INFO: https://www.builder.io/ has been tested before within the same run, it will get an extra query parameter named browsertime_run. Make sure to use alias to keep track of the URLs
[2024-12-01 15:19:34] INFO: Collecting Gecko profile from /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Cached/data/geckoProfile-1.json to /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Cached/data/geckoProfile-1.json
[2024-12-01 15:19:34] INFO: Stop GeckoProfiler.
[2024-12-01 15:19:34] INFO: Collecting CPU power consumtion
[2024-12-01 15:19:34] INFO: Gzip file the profile.
[2024-12-01 15:19:35] INFO: Done stopping GeckoProfiler.
[2024-12-01 15:19:35] INFO: CPU / Power usage: 8189
[2024-12-01 15:19:35] INFO: Take after page complete check screenshot
[2024-12-01 15:19:35] INFO: Take largest contentful paint screenshot
[2024-12-01 15:19:35] INFO: Start to measure Cached 2
[2024-12-01 15:19:35] INFO: Start GeckoProfiler with features: ["power"] and threads: ["GeckoMain","Compositor","Renderer"]
[2024-12-01 15:19:38] INFO: Navigating to url https://www.builder.io/ iteration 1
[2024-12-01 15:19:45] ERROR: Couldn't execute script named CUSTOM error:JavascriptError: TypeError: document.getElementById(...) is null
[2024-12-01 15:19:45] ERROR: Could not find element by id onetrust-accept-btn-handler
[2024-12-01 15:19:54] INFO: https://www.builder.io/ has been tested before within the same run, it will get an extra query parameter named browsertime_run. Make sure to use alias to keep track of the URLs
[2024-12-01 15:19:54] INFO: Collecting Gecko profile from /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Cached-2/data/geckoProfile-1.json to /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54/pages/www_builder_io/Cached-2/data/geckoProfile-1.json
[2024-12-01 15:19:54] INFO: Stop GeckoProfiler.
[2024-12-01 15:19:54] INFO: Collecting CPU power consumtion
[2024-12-01 15:19:54] INFO: Gzip file the profile.
[2024-12-01 15:19:54] INFO: Done stopping GeckoProfiler.
[2024-12-01 15:19:54] INFO: CPU / Power usage: 9604
[2024-12-01 15:19:54] INFO: Take after page complete check screenshot
[2024-12-01 15:19:54] INFO: Take largest contentful paint screenshot
[2024-12-01 15:19:57] INFO: https://www.builder.io/ 175 requests, TTFB: 76ms, firstPaint: 284ms, FCP: 284ms, DOMContentLoaded: 280ms, LCP: 279ms, CPUBenchmark: 25ms, Load: 856ms
[2024-12-01 15:19:57] INFO: https://www.builder.io/?browsertime_run=2 145 requests, TTFB: 17ms, firstPaint: 51ms, FCP: 50ms, DOMContentLoaded: 42ms, LCP: 49ms, CPUBenchmark: 25ms, Load: 239ms
[2024-12-01 15:19:57] INFO: https://www.builder.io/?browsertime_run=3 64 requests, TTFB: 27ms, firstPaint: 66ms, FCP: 67ms, DOMContentLoaded: 56ms, LCP: 55ms, CPUBenchmark: 25ms, Load: 259ms
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:57] INFO: The server responded with a 500 status code for https://www.builder.io/logan-test
[2024-12-01 15:19:58] INFO: HTML stored in /Users/plastic/Code/phd/sitespeed/sitespeed-result/builder-qwik_mjs/2024-12-01-15-18-54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the sitespeed.io command with Firefox, GeckoProfiler power settings, and builder-qwik.mjs to reproduce the three measurements. Inspect the scripting measurement flow and GeckoProfiler CPU power collection around the three commands.measure.start/stop sections. Done means each measurement reports its own CPU power usage rather than values accumulating across measurements.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.