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

Side by Side Diff: bench/FontCacheBench.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/FSRectBench.cpp ('k') | bench/FontScalerBench.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkChecksum.h" 10 #include "SkChecksum.h"
(...skipping 14 matching lines...) Expand all
25 25
26 class FontCacheBench : public Benchmark { 26 class FontCacheBench : public Benchmark {
27 public: 27 public:
28 FontCacheBench() {} 28 FontCacheBench() {}
29 29
30 protected: 30 protected:
31 const char* onGetName() override { 31 const char* onGetName() override {
32 return "fontcache"; 32 return "fontcache";
33 } 33 }
34 34
35 void onDraw(const int loops, SkCanvas* canvas) override { 35 void onDraw(int loops, SkCanvas* canvas) override {
36 SkPaint paint; 36 SkPaint paint;
37 this->setupPaint(&paint); 37 this->setupPaint(&paint);
38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
39 39
40 const uint16_t* array = gUniqueGlyphIDs; 40 const uint16_t* array = gUniqueGlyphIDs;
41 while (*array != gUniqueGlyphIDs_Sentinel) { 41 while (*array != gUniqueGlyphIDs_Sentinel) {
42 int count = count_glyphs(array); 42 int count = count_glyphs(array);
43 for (int i = 0; i < loops; ++i) { 43 for (int i = 0; i < loops; ++i) {
44 paint.measureText(array, count * sizeof(uint16_t)); 44 paint.measureText(array, count * sizeof(uint16_t));
45 } 45 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 FontCacheEfficiency() { 101 FontCacheEfficiency() {
102 if (false) dump_array(nullptr, 0); 102 if (false) dump_array(nullptr, 0);
103 if (false) rotr(0, 0); 103 if (false) rotr(0, 0);
104 } 104 }
105 105
106 protected: 106 protected:
107 const char* onGetName() override { 107 const char* onGetName() override {
108 return "fontefficiency"; 108 return "fontefficiency";
109 } 109 }
110 110
111 void onDraw(const int loops, SkCanvas* canvas) override { 111 void onDraw(int loops, SkCanvas* canvas) override {
112 static bool gDone; 112 static bool gDone;
113 if (gDone) { 113 if (gDone) {
114 return; 114 return;
115 } 115 }
116 gDone = true; 116 gDone = true;
117 117
118 for (int hashBits = 6; hashBits <= 12; hashBits += 1) { 118 for (int hashBits = 6; hashBits <= 12; hashBits += 1) {
119 int hashMask = ((1 << hashBits) - 1); 119 int hashMask = ((1 << hashBits) - 1);
120 for (int limit = 32; limit <= 1024; limit <<= 1) { 120 for (int limit = 32; limit <= 1024; limit <<= 1) {
121 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 121 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
(...skipping 16 matching lines...) Expand all
138 private: 138 private:
139 typedef Benchmark INHERITED; 139 typedef Benchmark INHERITED;
140 }; 140 };
141 141
142 /////////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////////
143 143
144 DEF_BENCH( return new FontCacheBench(); ) 144 DEF_BENCH( return new FontCacheBench(); )
145 145
146 // undefine this to run the efficiency test 146 // undefine this to run the efficiency test
147 //DEF_BENCH( return new FontCacheEfficiency(); ) 147 //DEF_BENCH( return new FontCacheEfficiency(); )
OLDNEW
« no previous file with comments | « bench/FSRectBench.cpp ('k') | bench/FontScalerBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698