Skip to main content

Speedtest for your CPU vs GPU — find out if GPU acceleration is actually worth it on your machine.

Project description

pixelbench

Speedtest for your CPU vs GPU — find out if GPU acceleration is actually worth it on your machine.

Live: pixelbench.netlify.app

pixelbench runs identical image-processing workloads (blur, threshold, edge detection, and more) on your CPU and your GPU, then shows you exactly where the GPU wins and where it embarrassingly loses. No CUDA required — it uses OpenCV's OpenCL backend, so it works on integrated Intel/AMD graphics, NVIDIA, and Apple machines alike.

Reality check. "GPUs are faster at image processing" is a half-truth. On the laptop this tool was born on (i5-12450H + Intel UHD graphics), the GPU is 4.6x faster at bilateral filtering — and 26% slower at a 4K Gaussian blur. Whether the GPU wins depends on the task, the image size, and your hardware. That's the whole point of measuring.

This project grew out of my bachelor's thesis at Kharkiv National University of Radio Electronics: "Computer Vision and the Effect of Hardware on the Performance of Image Processing Tasks."


Try it in your browser

pixelbench.netlify.app — the web/ folder contains pixelbench-web, the same comparison with no install: the CPU pass runs single-threaded TypeScript over typed arrays, the GPU pass runs WebGPU compute shaders (WGSL), and every GPU result is verified against the CPU output before it is reported.

  • Built with React + TypeScript + Vite; React Router for pages (benchmark + full methodology writeup)
  • Dark instrument-style UI: CPU/GPU comparison bars per operation, JetBrains Mono numerals, summary stat panel, JSON export
  • Deploys to Netlify as a static site (netlify.toml handles base, build, and the SPA redirect)
cd web
npm install
npm run dev

Note the two tools answer different questions: the CLI measures native performance (OpenCV + OpenCL), the web version measures the browser stack (JS vs WebGPU). Same machine, different stories — on the laptop this was built on, the GPU wins 10/10 in the browser but only 18/24 natively, because single-threaded JavaScript is a much softer baseline than OpenCV's hand-optimized C++.

Sample output

CPU: 12th Gen Intel(R) Core(TM) i5-12450H (12 threads)   GPU: Intel(R) UHD Graphics
Windows 11 · Python 3.12 · OpenCV 5.0 · median of 20 runs, 5 warmup

1080p
┌──────────────────────┬──────────┬──────────┬─────────────┐
│ Task                 │ CPU (ms) │ GPU (ms) │ GPU speedup │
├──────────────────────┼──────────┼──────────┼─────────────┤
│ Grayscale conversion │     0.97 │     0.58 │       1.67x │
│ Gaussian blur 15x15  │     4.92 │     5.14 │       0.96x │
│ Median blur 5x5      │     9.04 │     4.23 │       2.14x │
│ Bilateral filter d=9 │    44.49 │     9.62 │       4.63x │
│ Binary threshold     │     0.98 │     0.16 │       5.95x │
│ Sobel edges          │     1.53 │     0.64 │       2.38x │
│ Canny edges          │     5.06 │     1.87 │       2.71x │
│ Resize to 50%        │     0.61 │     0.52 │       1.16x │
└──────────────────────┴──────────┴──────────┴─────────────┘

Verdict: GPU won 18/24 tasks on this machine. Faster hardware isn't
always faster — it depends on the task and image size.

Install & run

Run it without cloning anything (uv required):

uvx --from git+https://github.com/OkeahDavid/pixelbench pixelbench

Or clone and run:

git clone https://github.com/OkeahDavid/pixelbench
cd pixelbench
uv run pixelbench

To install pixelbench as a permanent command: uv tool install .

No uv? pip works too: pip install -e . then pixelbench, or pip install opencv-python numpy rich and python -m pixelbench.

Options

pixelbench --sizes 720p,1080p,1440p,4k   # image sizes to test
           --tasks gaussian_blur,canny   # subset of tasks (default: all 8)
           --iterations 50               # timed runs per op (default: 20)
           --no-gpu                      # CPU-only pass
           --json results/mine.json      # save machine-readable results
           --leaderboard                 # print a row for the table below

Leaderboard

Run pixelbench --leaderboard and open a PR (or an issue) with your row — laptops, desktops, potatoes, and workstations all welcome. Median speedup is across all tasks and sizes.

CPU GPU OS Median GPU speedup Best win
12th Gen Intel(R) Core(TM) i5-12450H Intel(R) UHD Graphics Windows 1.90x 5.95x (Binary threshold, 1080p)

Methodology (the fine print that makes numbers honest)

  • Same code path, two backends. Every task calls the same OpenCV function; the CPU pass gets a numpy array, the GPU pass gets a cv2.UMat, which routes through OpenCV's transparent OpenCL API.
  • Transfer excluded. The test image is uploaded to the GPU before timing starts. Numbers measure compute, not PCIe/RAM copies. (A transfer-inclusive mode is on the roadmap — for one-shot processing it changes the story.)
  • Warmup runs precede every measurement, because OpenCL compiles kernels on first use and that spike shouldn't pollute your numbers.
  • Median, not mean. Each iteration is timed individually and the median is reported, so a background Windows update can't skew your results.
  • cv2.ocl.finish() after every GPU op, so asynchronous work can't leak outside the timing window.
  • Deterministic test image. A synthetic photo-like image (gradients + shapes + noise, fixed seed) is generated per size — every machine benchmarks the exact same pixels.

Roadmap

  • CUDA backend — detected automatically on CUDA-enabled OpenCV builds with an NVIDIA GPU; adds a third comparison column (CPU vs OpenCL vs CUDA). The standard opencv-python wheel does not include CUDA.
  • Transfer-inclusive timing mode (--include-transfer)
  • Speedup charts (--chart, matplotlib)
  • Hosted leaderboard with auto-submit

License

MIT © Okeah David Chidugam

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

pixelbench-0.2.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

pixelbench-0.2.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pixelbench-0.2.0.tar.gz.

File metadata

  • Download URL: pixelbench-0.2.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pixelbench-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5fff85633ede0eb59d90826cd878496e7d18ab6ac3af90ff549a9f2caa4ed683
MD5 579a7058523050c01b22ffef9b16f453
BLAKE2b-256 cc41a407dcb806d784cce53d68ee1a1bee4f47c02bc1dec030d5311936f4f864

See more details on using hashes here.

File details

Details for the file pixelbench-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pixelbench-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pixelbench-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8389412e551f0b82887501697bc239c832a9aef3becfe6eb019188c5d38d0f2d
MD5 025415689c1c0073b305bc4687f6e0ee
BLAKE2b-256 2800e55a2f79ef89f267ce969a89aac1ad0817a67d64487d8839f01a35dff470

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