Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: src/core/SkChecksum.h

Issue 877113002: use murmur3 finisher to improve font hash efficiency (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add CheapMix helper" Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkChecksum.h
diff --git a/src/core/SkChecksum.h b/src/core/SkChecksum.h
index 9f2ebf460aff1ed778183f1480a15f42b0dd1315..d9065f5ff3a18e0b99f422b3953ee10cac26c97d 100644
--- a/src/core/SkChecksum.h
+++ b/src/core/SkChecksum.h
@@ -52,6 +52,19 @@ public:
}
/**
+ * uint32_t -> uint32_t hash, useful for when you're about to trucate this hash but you
+ * suspect its low bits aren't well mixed.
+ *
+ * This version is 2-lines cheaper than Mix, but seems to be sufficient for the font cache.
+ */
+ static uint32_t CheapMix(uint32_t hash) {
+ hash ^= hash >> 16;
+ hash *= 0x85ebca6b;
+ hash ^= hash >> 16;
+ return hash;
+ }
+
+ /**
* Calculate 32-bit Murmur hash (murmur3).
* This should take 2-3x longer than SkChecksum::Compute, but is a considerably better hash.
* See en.wikipedia.org/wiki/MurmurHash.
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698