Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: bench/SortBench.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bench/ShaderMaskBench.cpp ('k') | bench/TextBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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); )
OLDNEW
« no previous file with comments | « bench/ShaderMaskBench.cpp ('k') | bench/TextBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698