From 46af7efbeecca4c0d9650378c8fe6add194f231e Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 2 May 2012 16:56:49 +0000 Subject: renormalize some loop counts for faster tests in regions git-svn-id: http://skia.googlecode.com/svn/trunk@3821 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/RegionBench.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bench/RegionBench.cpp') 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); -- cgit v1.2.3