aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SortBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-25 17:49:49 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-25 17:49:49 +0000
commita53dcce4b42fe5b8c4b1f8e51fce225e58befe5a (patch)
tree82c17df8002c2d9fa159702dc9ebbbdcb9d73cd1 /bench/SortBench.cpp
parent3bc72002401ed4b258587c0e59320502e37d28a6 (diff)
reduce array size in debug builds for sortbench. This avoids a stack-overflow
due to (1) SkTQSort's bad behavior on repeated-keys, and (2) windows-debug doesn't implement tail-recursion. Not an issue, since we don't care about perf in our debug builds anyway. git-svn-id: http://skia.googlecode.com/svn/trunk@7396 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/SortBench.cpp')
-rw-r--r--bench/SortBench.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/bench/SortBench.cpp b/bench/SortBench.cpp
index 30c08179ea..4b79251045 100644
--- a/bench/SortBench.cpp
+++ b/bench/SortBench.cpp
@@ -10,7 +10,15 @@
#include "SkTSort.h"
#include "SkString.h"
+#ifdef SK_DEBUG
+// Windows-debug builds (at least) don't implement tail-recursion, and we have
+// a bench that triggers a worst-case behavior in SkTQSort (w/ repeated keys)
+// which can overflow the stack if N is too big. So we reduce it for debug
+// builds (for which we don't care about sorting performance anyways).
+static const int N = 100;
+#else
static const int N = 1000;
+#endif
static void rand_proc(int array[], int count) {
SkRandom rand;