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

Side by Side Diff: bench/FontCacheBench.cpp

Issue 27343002: Second wave of Win64 warning cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Now compiling on Linux Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPictureRecord.h » ('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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkFontHost.h" 10 #include "SkFontHost.h"
11 #include "SkPaint.h" 11 #include "SkPaint.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 14
15 #include "gUniqueGlyphIDs.h" 15 #include "gUniqueGlyphIDs.h"
16 #define gUniqueGlyphIDs_Sentinel 0xFFFF 16 #define gUniqueGlyphIDs_Sentinel 0xFFFF
17 17
18 static int count_glyphs(const uint16_t start[]) { 18 static size_t count_glyphs(const uint16_t start[]) {
bsalomon 2013/10/15 17:35:20 this one looks like an int count to me, rest lgtm
robertphillips 2013/10/15 17:47:53 Done.
19 const uint16_t* curr = start; 19 const uint16_t* curr = start;
20 while (*curr != gUniqueGlyphIDs_Sentinel) { 20 while (*curr != gUniqueGlyphIDs_Sentinel) {
21 curr += 1; 21 curr += 1;
22 } 22 }
23 return curr - start; 23 return curr - start;
24 } 24 }
25 25
26 class FontCacheBench : public SkBenchmark { 26 class FontCacheBench : public SkBenchmark {
27 public: 27 public:
28 FontCacheBench() {} 28 FontCacheBench() {}
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 gDone = true; 127 gDone = true;
128 128
129 for (int hashBits = 6; hashBits <= 12; hashBits += 1) { 129 for (int hashBits = 6; hashBits <= 12; hashBits += 1) {
130 int hashMask = ((1 << hashBits) - 1); 130 int hashMask = ((1 << hashBits) - 1);
131 for (int limit = 32; limit <= 1024; limit <<= 1) { 131 for (int limit = 32; limit <= 1024; limit <<= 1) {
132 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 132 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
133 int collisions = 0; 133 int collisions = 0;
134 int glyphs = 0; 134 int glyphs = 0;
135 const uint16_t* array = gUniqueGlyphIDs; 135 const uint16_t* array = gUniqueGlyphIDs;
136 while (*array != gUniqueGlyphIDs_Sentinel) { 136 while (*array != gUniqueGlyphIDs_Sentinel) {
137 int count = SkMin32(count_glyphs(array), limit); 137 int count = static_cast<int>(SkTMin<size_t>(count_glyphs (array), limit));
138 collisions += count_collisions(array, count, gRec[i].fHa sher, hashMask); 138 collisions += count_collisions(array, count, gRec[i].fHa sher, hashMask);
139 glyphs += count; 139 glyphs += count;
140 array += count + 1; // skip the sentinel 140 array += count + 1; // skip the sentinel
141 } 141 }
142 SkDebugf("hashBits [%d] limit [%d] collisions [%d / %d = %1. 2g%%] using %s\n", hashBits, limit, collisions, glyphs, 142 SkDebugf("hashBits [%d] limit [%d] collisions [%d / %d = %1. 2g%%] using %s\n", hashBits, limit, collisions, glyphs,
143 collisions * 100.0 / glyphs, gRec[i].fName); 143 collisions * 100.0 / glyphs, gRec[i].fName);
144 } 144 }
145 } 145 }
146 } 146 }
147 } 147 }
148 148
149 private: 149 private:
150 typedef SkBenchmark INHERITED; 150 typedef SkBenchmark INHERITED;
151 }; 151 };
152 152
153 /////////////////////////////////////////////////////////////////////////////// 153 ///////////////////////////////////////////////////////////////////////////////
154 154
155 DEF_BENCH( return new FontCacheBench(); ) 155 DEF_BENCH( return new FontCacheBench(); )
156 156
157 // undefine this to run the efficiency test 157 // undefine this to run the efficiency test
158 //DEF_BENCH( return new FontCacheEfficiency(); ) 158 //DEF_BENCH( return new FontCacheEfficiency(); )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698