aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/RegionBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-02 16:56:49 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-02 16:56:49 +0000
commit46af7efbeecca4c0d9650378c8fe6add194f231e (patch)
tree9f00ad0f2c689e83b79667e40fa0bdd5a09cb818 /bench/RegionBench.cpp
parent684119d126942d7a68e7b0d8de4aad18c28f1744 (diff)
renormalize some loop counts for faster tests in regions
git-svn-id: http://skia.googlecode.com/svn/trunk@3821 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/RegionBench.cpp')
-rw-r--r--bench/RegionBench.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp
index 5e3f70c4d9..a520e4245d 100644
--- a/bench/RegionBench.cpp
+++ b/bench/RegionBench.cpp
@@ -58,6 +58,7 @@ public:
SkRegion fA, fB;
Proc fProc;
SkString fName;
+ int fLoopMul;
enum {
W = 1024,
@@ -73,9 +74,10 @@ public:
return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1);
}
- RegionBench(void* param, int count, Proc proc, const char name[]) : INHERITED(param) {
+ RegionBench(void* param, int count, Proc proc, const char name[], int mul = 1) : INHERITED(param) {
fProc = proc;
fName.printf("region_%s_%d", name, count);
+ fLoopMul = mul;
SkRandom rand;
for (int i = 0; i < count; i++) {
@@ -89,7 +91,8 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
Proc proc = fProc;
- for (int i = 0; i < N; ++i) {
+ int n = fLoopMul * N;
+ for (int i = 0; i < n; ++i) {
proc(fA, fB);
}
}
@@ -103,8 +106,8 @@ private:
static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, union_proc, "union")); }
static SkBenchmark* gF1(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sect_proc, "intersect")); }
static SkBenchmark* gF2(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diff_proc, "difference")); }
-static SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect")); }
-static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sects_proc, "intersects")); }
+static SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect", 100)); }
+static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sects_proc, "intersects", 10)); }
static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); }
static BenchRegistry gR0(gF0);