aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkOpts_crc32.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-08-22 08:53:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-22 08:53:45 -0700
commit78559a78f9d3e6444f8c0c9443696699703d6531 (patch)
tree22ddd055715ef77a469f66df999320cc7a5edcbb /src/opts/SkOpts_crc32.cpp
parentdd3259eb95c3b47e11eefa3b176365a112a32b48 (diff)
Use ARMv8 CRC32 instructions for SkOpts::hash().
For large inputs, this runs ~11x faster than Murmur3. My bench drops from 1µs to 88ns. Like x86-64, this runs fastest if we work in 24 byte chunks. 16 byte chunks run at about 0.75x this speed, 8 byte chunks at about 0.4x (which would still be about 5x faster than Murmur3). This'll require plumbing support for opts_crc32 into Chrome first before it can roll. perf.skia.org charts we want to watch: https://perf.skia.org/#5490 Seach for compute_hash in these logs to see the difference: baseline: https://luci-milo.appspot.com/swarming/task/30ba22f3dfe30e10/steps/nanobench/0/stdout trybot: https://luci-milo.appspot.com/swarming/task/30bbc406cbf62d10/steps/nanobench/0/stdout BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2260823002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2260823002
Diffstat (limited to 'src/opts/SkOpts_crc32.cpp')
-rw-r--r--src/opts/SkOpts_crc32.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/opts/SkOpts_crc32.cpp b/src/opts/SkOpts_crc32.cpp
new file mode 100644
index 0000000000..8fc88aa7f5
--- /dev/null
+++ b/src/opts/SkOpts_crc32.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkOpts.h"
+
+#define SK_OPTS_NS crc32
+#include "SkChecksum_opts.h"
+
+namespace SkOpts {
+ void Init_crc32() {
+ hash_fn = crc32::hash_fn;
+ }
+}