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

Side by Side Diff: bench/Matrix44Bench.cpp

Issue 22872015: Add performance benchmark before landing perf improvements that remove sk_bezero in SkMatrix44 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: real patch for landing, previous one is wrong 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 | « no previous file | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkMatrix44.h" 9 #include "SkMatrix44.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 (void) (fM0 == fM1); 51 (void) (fM0 == fM1);
52 (void) (fM1 == fM2); 52 (void) (fM1 == fM2);
53 (void) (fM2 == fM0); 53 (void) (fM2 == fM0);
54 } 54 }
55 } 55 }
56 private: 56 private:
57 SkMatrix44 fM0, fM1, fM2; 57 SkMatrix44 fM0, fM1, fM2;
58 typedef Matrix44Bench INHERITED; 58 typedef Matrix44Bench INHERITED;
59 }; 59 };
60 60
61 class SetIdentityMatrix44Bench : public Matrix44Bench {
62 public:
63 SetIdentityMatrix44Bench(void* param) : INHERITED(param, "setidentity") {
64 double rowMajor[16] =
65 { 1, 2, 3, 4,
66 5, 6, 7, 8,
67 9, 10, 11, 12,
68 13, 14, 15, 16};
69 mat.setRowMajord(rowMajor);
70 }
71 protected:
72 virtual void performTest() {
73 for (int i = 0; i < 10; ++i) {
74 mat.setIdentity();
75 }
76 }
77 private:
78 SkMatrix44 mat;
79 typedef Matrix44Bench INHERITED;
80 };
81
61 class PreScaleMatrix44Bench : public Matrix44Bench { 82 class PreScaleMatrix44Bench : public Matrix44Bench {
62 public: 83 public:
63 PreScaleMatrix44Bench(void* param) : INHERITED(param, "prescale") { 84 PreScaleMatrix44Bench(void* param) : INHERITED(param, "prescale") {
64 fX = fY = fZ = SkDoubleToMScalar(1.5); 85 fX = fY = fZ = SkDoubleToMScalar(1.5);
65 } 86 }
66 protected: 87 protected:
67 virtual void performTest() { 88 virtual void performTest() {
68 fM0.reset(); 89 fM0.reset();
69 for (int i = 0; i < 10; ++i) { 90 for (int i = 0; i < 10; ++i) {
70 fM0.preScale(fX, fY, fZ); 91 fM0.preScale(fX, fY, fZ);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 for (int i = 0; i < 20; ++i) { 246 for (int i = 0; i < 20; ++i) {
226 fMatrix.set(1, 2, 1); // to invalidate the type-cache 247 fMatrix.set(1, 2, 1); // to invalidate the type-cache
227 fMatrix.getType(); 248 fMatrix.getType();
228 } 249 }
229 } 250 }
230 private: 251 private:
231 SkMatrix44 fMatrix; 252 SkMatrix44 fMatrix;
232 typedef Matrix44Bench INHERITED; 253 typedef Matrix44Bench INHERITED;
233 }; 254 };
234 255
256 DEF_BENCH( return new SetIdentityMatrix44Bench(p); )
235 DEF_BENCH( return new EqualsMatrix44Bench(p); ) 257 DEF_BENCH( return new EqualsMatrix44Bench(p); )
236 DEF_BENCH( return new PreScaleMatrix44Bench(p); ) 258 DEF_BENCH( return new PreScaleMatrix44Bench(p); )
237 DEF_BENCH( return new PostScaleMatrix44Bench(p); ) 259 DEF_BENCH( return new PostScaleMatrix44Bench(p); )
238 DEF_BENCH( return new InvertMatrix44Bench(p); ) 260 DEF_BENCH( return new InvertMatrix44Bench(p); )
239 DEF_BENCH( return new InvertAffineMatrix44Bench(p); ) 261 DEF_BENCH( return new InvertAffineMatrix44Bench(p); )
240 DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(p); ) 262 DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(p); )
241 DEF_BENCH( return new InvertTranslateMatrix44Bench(p); ) 263 DEF_BENCH( return new InvertTranslateMatrix44Bench(p); )
242 DEF_BENCH( return new SetConcatMatrix44Bench(p); ) 264 DEF_BENCH( return new SetConcatMatrix44Bench(p); )
243 DEF_BENCH( return new GetTypeMatrix44Bench(p); ) 265 DEF_BENCH( return new GetTypeMatrix44Bench(p); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698