Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark: add squoosh-cli #2643

Closed
lovell opened this issue Mar 29, 2021 · 4 comments
Closed

Benchmark: add squoosh-cli #2643

lovell opened this issue Mar 29, 2021 · 4 comments

Comments

@lovell
Copy link
Owner

lovell commented Mar 29, 2021

https://www.npmjs.com/package/@squoosh/cli

I've created a work-in-progress branch to track this at bench-add-squoosh, e.g. commit 11720ab

It's very likely there are incorrect or missing settings that prevent the tests being a fair comparison so feedback/improvements are welcome. It does have to invoke a new process, which will have an overhead.

Some very early, initial testing suggests squoosh-cli is faster than jimp, but ~6x slower than GraphicsMagick (also invokes a new process) and ~25x slower than sharp.

jimp-file-file x 0.57 ops/sec ±5.91% (7 runs sampled)
squoosh-cli-file-file x 0.96 ops/sec ±7.27% (9 runs sampled)
gm-file-file x 6.51 ops/sec ±3.99% (35 runs sampled)
sharp-file-file x 25.01 ops/sec ±3.23% (61 runs sampled)
@tomByrer
Copy link

tomByrer commented May 2, 2021

From my usage of both squoosh.app & Squoosh-cli is the CLI feels more like a more crippled & poorly documented version of the app. EG I'm testing out the AVIF output, & didn't see lossless in the CLI but there was a checkbox in the app.

Also Squoosh.app 'Effort' is 0=fastest, MAX(7-10, depends)=smallest, but I think your 'speed' is 0=smallest, 8=fastest.

I should give you some of the test images I created to help test color shifting.

@styfle
Copy link

styfle commented Jul 8, 2021

It might be better to benchmark @squoosh/lib instead of @squoosh/cli

@lovell
Copy link
Owner Author

lovell commented Jul 9, 2021

It's probably worth including both. Using the "lib" variant of Squoosh removes any spawning overhead but with it brings GPLv3 code into the same process as node, which not everyone will be OK with.

@lovell
Copy link
Owner Author

lovell commented Aug 17, 2021

squoosh/lib is definitely faster that its CLI, perhaps 60-70%, perhaps as the WASM files don't have to be compiled on each invocation. It is still ~17x slower than sharp for a "typical" JPEG decode/resize/encode roundtrip.

These modules are now included in the performance test results - see https://sharp.pixelplumbing.com/performance - remember that squoosh/lib contains GPLv3 logic so any code that runs in the same Node.js process should also be considered GPLv3.

Again it's very likely there'll be something needed to improve in the benchmark code and ensure a fair comparison - PRs to make it so are welcome, as always.

@lovell lovell closed this as completed Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants