Even when autovectorized, using MaxComponentDifference is slower than memcmp.
And debug builds (most runs of DM) will never even be autovectorized.
DM::MaxComponentDifference is the top function on DM profile, and memcmp moves
to ~20th.
BUG=skia:
R=halcanary@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/
315743002
}
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
- return a.info() == b.info() && 0 == MaxComponentDifference(a, b);
+ if (a.info() != b.info()) {
+ return false;
+ }
+ const SkAutoLockPixels lockA(a), lockB(b);
+ return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize());
}
} // namespace DM