diff options
author | mtklein <mtklein@chromium.org> | 2015-07-27 11:08:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-27 11:08:28 -0700 |
commit | 58fd2c8af4fc4debbf3c9f3cf7783971982bd6dc (patch) | |
tree | e1bc172dafab6416e0de9a243ceaf4cd51257b5b /bench | |
parent | ce2c5055cee5d5d3c9fc84c1b3eeed4b4d84a827 (diff) |
Remove sk_memcpy32
It's only implemented on x86, where the exisiting benchmark says memcpy() is
faster for all cases:
Timer overhead: 24ns
curr/maxrss loops min median mean max stddev samples config bench
10/10 MB 1 35.9µs 36.2µs 36.2µs 36.6µs 1% ▁▂▄▅▅▃█▄▄▅ nonrendering sk_memcpy32_100000
10/10 MB 13 2.27µs 2.28µs 2.28µs 2.29µs 0% █▄▃▅▃▁▃▅▁▄ nonrendering sk_memcpy32_10000
11/11 MB 677 91.6ns 95.9ns 94.5ns 99.4ns 3% ▅▅▅▅▅█▁▁▁▁ nonrendering sk_memcpy32_1000
11/11 MB 1171 20ns 20.9ns 21.3ns 23.4ns 6% ▁▁▇▃▃▃█▇▃▃ nonrendering sk_memcpy32_100
11/11 MB 1952 14ns 14ns 14.3ns 15.2ns 3% ▁▁██▁▁▁▁▁▁ nonrendering sk_memcpy32_10
11/11 MB 5 33.6µs 33.7µs 34.1µs 35.2µs 2% ▆▇█▁▁▁▁▁▁▁ nonrendering memcpy32_memcpy_100000
11/11 MB 18 2.12µs 2.22µs 2.24µs 2.39µs 5% ▂█▄▇█▄▇▁▁▁ nonrendering memcpy32_memcpy_10000
11/11 MB 1112 87.3ns 87.3ns 89.1ns 93.7ns 3% ▄██▄▁▁▁▁▁▁ nonrendering memcpy32_memcpy_1000
11/11 MB 2124 12.8ns 13.3ns 13.5ns 14.8ns 6% ▁▁▁█▃▃█▇▃▃ nonrendering memcpy32_memcpy_100
11/11 MB 3077 9ns 9.41ns 9.52ns 10.2ns 4% ▃█▁█▃▃▃▃▃▃ nonrendering memcpy32_memcpy_10
(Why? One fewer thing to port to SkOpts.)
BUG=skia:4117
Review URL: https://codereview.chromium.org/1256763003
Diffstat (limited to 'bench')
-rw-r--r-- | bench/MemcpyBench.cpp | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/bench/MemcpyBench.cpp b/bench/MemcpyBench.cpp deleted file mode 100644 index 4bc1285607..0000000000 --- a/bench/MemcpyBench.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "Benchmark.h" -#include "SkRandom.h" -#include "SkTemplates.h" -#include "SkUtils.h" - -template <typename Memcpy32> -class Memcpy32Bench : public Benchmark { -public: - explicit Memcpy32Bench(int count, Memcpy32 memcpy32, const char* name) - : fCount(count) - , fMemcpy32(memcpy32) - , fName(SkStringPrintf("%s_%d", name, count)) {} - - const char* onGetName() override { - return fName.c_str(); - } - - bool isSuitableFor(Backend backend) override { - return backend == kNonRendering_Backend; - } - - void onPreDraw() override { - fDst.reset(fCount); - fSrc.reset(fCount); - - SkRandom rand; - for (int i = 0; i < fCount; i++) { - fSrc[i] = rand.nextU(); - } - } - - void onDraw(const int loops, SkCanvas*) override { - for (int i = 0; i < loops; i++) { - fMemcpy32(fDst, fSrc, fCount); - } - } - -private: - SkAutoTMalloc<uint32_t> fDst, fSrc; - - int fCount; - Memcpy32 fMemcpy32; - const SkString fName; -}; - -template <typename Memcpy32> -static Memcpy32Bench<Memcpy32>* Bench(int count, Memcpy32 memcpy32, const char* name) { - return new Memcpy32Bench<Memcpy32>(count, memcpy32, name); -} -#define BENCH(memcpy32, count) DEF_BENCH(return Bench(count, memcpy32, #memcpy32); ) - - -// Let the libc developers do what they think is best. -static void memcpy32_memcpy(uint32_t* dst, const uint32_t* src, int count) { - memcpy(dst, src, sizeof(uint32_t) * count); -} -BENCH(memcpy32_memcpy, 10) -BENCH(memcpy32_memcpy, 100) -BENCH(memcpy32_memcpy, 1000) -BENCH(memcpy32_memcpy, 10000) -BENCH(memcpy32_memcpy, 100000) - -// Test our chosen best, from SkUtils.h -BENCH(sk_memcpy32, 10) -BENCH(sk_memcpy32, 100) -BENCH(sk_memcpy32, 1000) -BENCH(sk_memcpy32, 10000) -BENCH(sk_memcpy32, 100000) - -#undef BENCH |