| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
| 9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
| 10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
| 11 #include "SkString.h" | 11 #include "SkString.h" |
| 12 | 12 |
| 13 static const int N = 1000; | 13 static const int N = 1000; |
| 14 | 14 |
| 15 static void rand_proc(int array[], int count) { | 15 static void rand_proc(int array[], int count) { |
| 16 SkMWCRandom rand; | 16 SkRandom rand; |
| 17 for (int i = 0; i < count; ++i) { | 17 for (int i = 0; i < count; ++i) { |
| 18 array[i] = rand.nextS(); | 18 array[i] = rand.nextS(); |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 static void randN_proc(int array[], int count) { | 22 static void randN_proc(int array[], int count) { |
| 23 SkMWCRandom rand; | 23 SkRandom rand; |
| 24 int mod = N / 10; | 24 int mod = N / 10; |
| 25 for (int i = 0; i < count; ++i) { | 25 for (int i = 0; i < count; ++i) { |
| 26 array[i] = rand.nextU() % mod; | 26 array[i] = rand.nextU() % mod; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 static void forward_proc(int array[], int count) { | 30 static void forward_proc(int array[], int count) { |
| 31 for (int i = 0; i < count; ++i) { | 31 for (int i = 0; i < count; ++i) { |
| 32 array[i] = i; | 32 array[i] = i; |
| 33 } | 33 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 DEF_BENCH( return NewSkHeap(p, kFore); ) | 161 DEF_BENCH( return NewSkHeap(p, kFore); ) |
| 162 DEF_BENCH( return NewQSort(p, kFore); ) | 162 DEF_BENCH( return NewQSort(p, kFore); ) |
| 163 | 163 |
| 164 DEF_BENCH( return NewSkQSort(p, kBack); ) | 164 DEF_BENCH( return NewSkQSort(p, kBack); ) |
| 165 DEF_BENCH( return NewSkHeap(p, kBack); ) | 165 DEF_BENCH( return NewSkHeap(p, kBack); ) |
| 166 DEF_BENCH( return NewQSort(p, kBack); ) | 166 DEF_BENCH( return NewQSort(p, kBack); ) |
| 167 | 167 |
| 168 DEF_BENCH( return NewSkQSort(p, kSame); ) | 168 DEF_BENCH( return NewSkQSort(p, kSame); ) |
| 169 DEF_BENCH( return NewSkHeap(p, kSame); ) | 169 DEF_BENCH( return NewSkHeap(p, kSame); ) |
| 170 DEF_BENCH( return NewQSort(p, kSame); ) | 170 DEF_BENCH( return NewQSort(p, kSame); ) |
| OLD | NEW |