Skip to main content

A cross-browser, cross-system benchmark runner

Project description

Crossbench

Crossbench is a cross-browser/cross-benchmark runner to extract performance numbers.

Mailing list: crossbench@chromium.org

Issues/Bugs: Tests > CrossBench

Supported Browsers: Chrome/Chromium, Firefox, Safari and Edge.

Supported OS: macOS, Android, linux and windows.

Basic usage:

Chromium Devs (with a full chromium checkout)

Use the ./cb.py script to run benchmarks (requires chrome's vpython3)

Standalone installation

Use the "poetry" package manager, see the development section.

Run the latest speedometer benchmark 20 times with the system default browser (chrome-stable):

# Run chrome-stable by default:
./cb.py speedometer --repeat=20

# Compare browsers on jetstream:
./cb.py jetstream --browser=chrome-stable --browser=chrome-m90 --browser=$PATH

Profile individual line items (with pprof on linux):

./cb.py speedometer --probe='profiling' --separate

Use a custom chrome build and only run a subset of the stories:

./cb.py speedometer --browser=$PATH --probe='profiling' --story='Ember.*'

Profile a website for 17 seconds on Chrome M100 (auto-downloading on macOS and linux):

./cb.py loading --browser=chrome-m100 --probe='profiling' --url=www.cnn.com,17s

Main Components

Browsers

Crossbench supports running benchmarks on one or multiple browser configurations. The main implementation uses selenium for maximum system independence.

You can specify a browser with --browser=<name>. You can repeat the --browser argument to run multiple browser. If you need custom flags for multiple browsers use --browser-config (or pass simple flags after -- to the browser).

./cb.py speedometer --browser=$BROWSER -- --enable-field-trial-config

Browser Config File

For more complex scenarios you can use a browser.config.hjson file. It allows you to specify multiple browser and multiple flag configurations in a single file and produce performance numbers with a single invocation.

./cb.py speedometer --browser-config=config.hjson

The example file lists and explains all configuration details.

Probes

Probes define a way to extract arbitrary (performance) numbers from a host or running browser. This can reach from running simple JS-snippets to extract page-specific numbers to system-wide profiling.

Multiple probes can be added with repeated --probe='XXX' options. You can use the describe probes subcommand to list all probes:

# List all probes:
./cb.py describe probes

# List help for an individual probe:
./cb.py describe probe v8.log

Inline Probe Config

Some probes can be configured, either with inline json when using --probe or in a separate --probe-config hjson file. Use the describe command to list all options.

# Get probe config details:
./cb.py describe probe v8.log

# Use inline hjson to configure a probe:
./cb.py speedometer --probe='v8.log:{prof:true}'

Probe Config File

For complex probe setups you can use --probe-config=<file>. The example file lists and explains all configuration details. For the specific probe configuration properties consult the describe command.

Benchmarks

Use the describe command to list all benchmark details:

# List all benchmark info:
./cb.py describe benchmarks

# List an individual benchmark info:
./cb.py describe benchmark speedometer_2.1

# List a benchmark's command line options:
./cb.py speedometer_2.1 --help

Stories

Stories define sequences of browser interactions. This can be simply loading a URL and waiting for a given period of time, or in more complex scenarios, actively interact with a page and navigate multiple times.

Use --help or describe to list all stories for a benchmark:

./cb.py speedometer --help

Use --stories to list individual story names, or use regular expression as filter.

./cb.py speedometer --browser=$BROWSER --stories='VanillaJS.*'

Development

Setup

This project uses poetry deps and package scripts to setup the correct environment for testing and debugging.

# a) On debian:
sudo apt-get install python3.10 python3-poetry
# b) With python 3.8 to 3.10 installed already:
pip3 install poetry

Check that you have poetry on your path and make sure you have the right $PATH settings.

poetry --help || echo "Please update your \$PATH to include poetry bin location";
# Depending on your setup, add one of the following to your $PATH:
echo "`python3 -m site --user-base`/bin";
python3 -c "import sysconfig; print(sysconfig.get_path('scripts'))";

Install the necessary dependencies from the lock file using poetry:

# Select the python version you want to use (3.8 to 3.10):
poetry env use 3.10
poetry install

# For python 3.11 you have to skip pytype support:
poetry env use 3.11
poetry install --without=dev-pytype

Crossbench

For local development / non-chromium installation you should use poetry run cb ... instead of ./cb.py ....

Side-note, beware that poetry eats up an empty --:

# With cb.py:
./cb.py speedometer ... -- --custom-chrome-flag ...
# With poetry:
poetry run cb speedometer ... -- -- --custom-chrome-flag ...

Tests

poetry run pytest

Run detailed test coverage:

poetry run pytest --cov=crossbench --cov-report=html

Run pytype type checker:

poetry run pytype -j auto . 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crossbench-0.0.1.tar.gz (195.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crossbench-0.0.1-py3-none-any.whl (284.1 kB view details)

Uploaded Python 3

File details

Details for the file crossbench-0.0.1.tar.gz.

File metadata

  • Download URL: crossbench-0.0.1.tar.gz
  • Upload date:
  • Size: 195.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.8 Darwin/23.2.0

File hashes

Hashes for crossbench-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2e3caeef713a0773f225f7337c1dc7f7048c8f315ffbe30f6d6fbfb611668e94
MD5 8d381a9002348a08611c789a8d7b807d
BLAKE2b-256 13ef4ed3ede0def0d127b3ab7d41230eb482b7da156f2a06a331a0652c45d186

See more details on using hashes here.

File details

Details for the file crossbench-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: crossbench-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 284.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.8 Darwin/23.2.0

File hashes

Hashes for crossbench-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1a415998d2558f7c986900b4ad47b44b9b83058c7b53e59c7f0eabd487bc53f
MD5 31ded7cb574c9ffd44fb8c6e8c018787
BLAKE2b-256 4246c3bb56db52009e342c70ceb821317b3faa3c9dff2cd99f679f3179db2bbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page