Skip to content

chore: add benchmark#109

Merged
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-460.bench
Mar 17, 2025
Merged

chore: add benchmark#109
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-460.bench

Conversation

@KuznetsovRoman
Copy link
Member

@KuznetsovRoman KuznetsovRoman commented Mar 13, 2025

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-460.bench branch 6 times, most recently from f6b0729 to 0af9919 Compare March 13, 2025 11:03
Comment on lines +8 to +9
[0, Number.MIN_VALUE, 1 - diffPercent],
[Number.MIN_VALUE, JND, diffPercent]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diffPercent part of pixels would have diff somewhere between 0 and JND (which is 2.3)
1 - diffPercent part of pixels would be equal

Comment on lines +6 to +7
const abMinValue = -38;
const abMaxValue = 128;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cielab specs, minValue could be even -128, but they translate to the same rgb color

this._suitableBucketColors = getSuitableBucketRgbColors(histBuckets, REFERENCE_COLOR);
}

getRandomRgbColor() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generates random color, based on the provided histogram

Comment on lines +19 to +21
benchmark.addEventListener('start', () => {
doneTasksCount++;
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"start" is emitted on "warmup" end. Progress bar need to count "warmup" as a task too

@@ -0,0 +1,71 @@
# looks-same Benchmark

This benchmark evaluates the performance of four npm packages for image comparison: [`looks-same`](https://github.com/gemini-testing/looks-same), [`pixelmatch`](https://github.com/mapbox/pixelmatch), [`resemblejs`](https://github.com/rsmbl/Resemble.js), and [`blink-diff`](https://github.com/yahoo/blink-diff).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blink-diff is archived. Should we still use it?

Copy link
Member Author

@KuznetsovRoman KuznetsovRoman Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repo is archived, but the package is not deprecated: https://www.npmjs.com/package/blink-diff
So why not? 4 > 3

| looks-same | 42.81 | 41 | 56.26 | 41.95 | 53.13 |
| pixelmatch | 49.13 | 47.32 | 53.28 | 48.32 | 52.86 |
| resemblejs | 46.57 | 44.38 | 71.32 | 45.76 | 58.08 |
| blink-diff | 62.19 | 55.29 | 73.72 | 61.96 | 73.52 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's worth highlighting the best results in some color (green)? So that the winner is immediately visible.
Moreover a lot of numbers here, looks like we can remove min and max in order to simplify the table

Object.assign(module.exports, require('./reference-generator'));
Object.assign(module.exports, require('./contrast-to-reference-generator'));
Object.assign(module.exports, require('./fixed-visible-diff-amount-generator'));
Object.assign(module.exports, require('./fixed-invisible-diff-amount-generator'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we should write code like this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed:

exports.WebAverageFailedGenerator = require('./web-average-failed-generator').WebAverageFailedGenerator;
exports.WebAverageSuccessGenerator = require('./web-average-success-generator').WebAverageSuccessGenerator;
exports.ReferenceGenerator = require('./reference-generator').ReferenceGenerator;
exports.ContrastToReferenceGenerator = require('./contrast-to-reference-generator').ContrastToReferenceGenerator;
exports.FixedVisibleDiffAmountGenerator = require('./fixed-visible-diff-amount-generator').FixedVisibleDiffAmountGenerator;

@KuznetsovRoman KuznetsovRoman merged commit ac14c63 into master Mar 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants