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

Side by Side Diff: bench/SortBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 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
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | bench/StrokeBench.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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const char* onGetName() override { 117 const char* onGetName() override {
118 return fName.c_str(); 118 return fName.c_str();
119 } 119 }
120 120
121 // Delayed initialization only done if onDraw will be called. 121 // Delayed initialization only done if onDraw will be called.
122 void onDelayedSetup() override { 122 void onDelayedSetup() override {
123 fUnsorted.reset(N); 123 fUnsorted.reset(N);
124 gRec[fType].fProc(fUnsorted.get()); 124 gRec[fType].fProc(fUnsorted.get());
125 } 125 }
126 126
127 void onDraw(const int loops, SkCanvas*) override { 127 void onDraw(int loops, SkCanvas*) override {
128 SkAutoTMalloc<int> sorted(N); 128 SkAutoTMalloc<int> sorted(N);
129 for (int i = 0; i < loops; i++) { 129 for (int i = 0; i < loops; i++) {
130 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int)); 130 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int));
131 fSortProc(sorted.get()); 131 fSortProc(sorted.get());
132 #ifdef SK_DEBUG 132 #ifdef SK_DEBUG
133 for (int j = 1; j < N; ++j) { 133 for (int j = 1; j < N; ++j) {
134 SkASSERT(sorted[j - 1] <= sorted[j]); 134 SkASSERT(sorted[j - 1] <= sorted[j]);
135 } 135 }
136 #endif 136 #endif
137 } 137 }
(...skipping 27 matching lines...) Expand all
165 DEF_BENCH( return NewSkHeap(kFore); ) 165 DEF_BENCH( return NewSkHeap(kFore); )
166 DEF_BENCH( return NewQSort(kFore); ) 166 DEF_BENCH( return NewQSort(kFore); )
167 167
168 DEF_BENCH( return NewSkQSort(kBack); ) 168 DEF_BENCH( return NewSkQSort(kBack); )
169 DEF_BENCH( return NewSkHeap(kBack); ) 169 DEF_BENCH( return NewSkHeap(kBack); )
170 DEF_BENCH( return NewQSort(kBack); ) 170 DEF_BENCH( return NewQSort(kBack); )
171 171
172 DEF_BENCH( return NewSkQSort(kSame); ) 172 DEF_BENCH( return NewSkQSort(kSame); )
173 DEF_BENCH( return NewSkHeap(kSame); ) 173 DEF_BENCH( return NewSkHeap(kSame); )
174 DEF_BENCH( return NewQSort(kSame); ) 174 DEF_BENCH( return NewQSort(kSame); )
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | bench/StrokeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698