DM: go back to memcmp for BitmapsEqual
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
diff --git a/dm/DMUtil.cpp b/dm/DMUtil.cpp
index d7d6691..f142d47 100644
--- a/dm/DMUtil.cpp
+++ b/dm/DMUtil.cpp
@@ -84,7 +84,11 @@
}
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