Skip to content

benchmark against other image libraries - #61

Merged
matmen merged 1 commit into
masterfrom
benchmarks
Oct 16, 2026
Merged

matmen merged 1 commit into
masterfrom
benchmarks

Conversation

@matmen

@matmen matmen commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Adds bench/, a benchmark comparing ImageScript with ImageScript 1, Jimp, image-js, Photon, sharp and @napi-rs/canvas. It measures:

  • decoding and encoding
  • image operations
  • text and SVG rendering
  • animated GIFs
  • encoded file sizes
  • install sizes

The results, with charts, go to bench/README.md, and the main README links to them.

  • run.js runs every library in its own process (bench.js). @napi-rs/canvas frees native memory only in finalizers, so for that library the run calls gc() and yields to the event loop between iterations. Without this, its memory grew by several GB. Skia draws lazily, so a single-pixel getImageData forces it to actually render; otherwise its numbers are fake.
  • installs.js runs npm install for each library in an empty project and measures node_modules and the number of packages actually installed.
  • report.js draws the charts and writes the README.
  • Inputs come from Wikimedia Commons (CC BY 2.0, CC0, public domain). Sources and licenses are in bench/inputs/SOURCES.md.
  • Dependency versions are pinned exactly in bench/package.json. IMAGESCRIPT=local benchmarks dist/ instead of the npm package.

CI: release.yml has a new bench job for regular releases (dist-tag latest). It calls bench.yml, which installs the version that was just published, runs everything and commits the results to master. bench.yml can also be run by hand with a version.

Notes:

  • The committed results come from a noisy LXC (±10–20%). Running bench.yml once after merging replaces them with runner numbers.
  • If master gets branch protection, the job's push needs a bypass.

@matmen matmen added this to the v3.2.0 milestone Oct 16, 2026
@matmen matmen self-assigned this Oct 16, 2026
@matmen matmen added the enhancement New feature or request label Oct 16, 2026
bench/ compares ImageScript to ImageScript 1, Jimp, image-js, Photon, sharp and @napi-rs/canvas: decoding,
encoding, image operations, text and SVG rendering, animated GIFs, encoded file sizes and install sizes. Every
library runs in its own process (run.js), install sizes are measured with npm in an empty project (installs.js),
report.js draws the charts and writes bench/README.md. The release workflow runs it for every regular release
against the released version and commits the results; bench.yml can also be run by hand.

Inputs are from Wikimedia Commons (CC BY 2.0, CC0, public domain, see bench/inputs/SOURCES.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
@matmen
matmen merged commit 4cb4753 into master Oct 16, 2026
13 checks passed
@matmen
matmen deleted the benchmarks branch October 16, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant