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

Side by Side Diff: bench/MatrixBench.cpp

Issue 1040783002: use table of procs (and unrolling) to speed up mapPts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | include/core/SkMatrix.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkMatrixUtils.h" 10 #include "SkMatrixUtils.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 DEF_BENCH( return new InvertMapRectMatrixBench( 261 DEF_BENCH( return new InvertMapRectMatrixBench(
262 "invert_maprect_typemask_nonpersp", 262 "invert_maprect_typemask_nonpersp",
263 InvertMapRectMatrixBench::kUncachedTypeMask_Flag | 263 InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
264 InvertMapRectMatrixBench::kScale_Flag | 264 InvertMapRectMatrixBench::kScale_Flag |
265 InvertMapRectMatrixBench::kRotate_Flag | 265 InvertMapRectMatrixBench::kRotate_Flag |
266 InvertMapRectMatrixBench::kTranslate_Flag); ) 266 InvertMapRectMatrixBench::kTranslate_Flag); )
267 267
268 /////////////////////////////////////////////////////////////////////////////// 268 ///////////////////////////////////////////////////////////////////////////////
269 269
270 static SkMatrix make_ident() { SkMatrix m; m.reset(); return m; } 270 static SkMatrix make_trans() { return SkMatrix::MakeTrans(2, 3); }
271 static SkMatrix make_trans() { SkMatrix m; m.setTranslate(2, 3); return m; }
272 static SkMatrix make_scale() { SkMatrix m(make_trans()); m.postScale(1.5f, 0.5f) ; return m; } 271 static SkMatrix make_scale() { SkMatrix m(make_trans()); m.postScale(1.5f, 0.5f) ; return m; }
273 static SkMatrix make_afine() { SkMatrix m(make_trans()); m.postRotate(15); retur n m; } 272 static SkMatrix make_afine() { SkMatrix m(make_trans()); m.postRotate(15); retur n m; }
274 273
275 class MapPointsMatrixBench : public MatrixBench { 274 class MapPointsMatrixBench : public MatrixBench {
276 protected: 275 protected:
277 SkMatrix fM; 276 SkMatrix fM;
278 enum { 277 enum {
279 N = 32 278 N = 32
280 }; 279 };
281 SkPoint fSrc[N], fDst[N]; 280 SkPoint fSrc[N], fDst[N];
(...skipping 13 matching lines...) Expand all
295 for (int i = 0; i < 1000000; ++i) { 294 for (int i = 0; i < 1000000; ++i) {
296 fM.mapPts(fDst, fSrc, N); 295 fM.mapPts(fDst, fSrc, N);
297 } 296 }
298 } else { 297 } else {
299 for (int i = 0; i < 1000000; ++i) { 298 for (int i = 0; i < 1000000; ++i) {
300 fM.mapPoints(fDst, fSrc, N); 299 fM.mapPoints(fDst, fSrc, N);
301 } 300 }
302 } 301 }
303 } 302 }
304 }; 303 };
305 DEF_BENCH( return new MapPointsMatrixBench("mappts_ident0", make_ident(), false) ; )
306 DEF_BENCH( return new MapPointsMatrixBench("mappts_ident1", make_ident(), true); )
307 DEF_BENCH( return new MapPointsMatrixBench("mappts_trans0", make_trans(), false) ; ) 304 DEF_BENCH( return new MapPointsMatrixBench("mappts_trans0", make_trans(), false) ; )
308 DEF_BENCH( return new MapPointsMatrixBench("mappts_trans1", make_trans(), true); ) 305 DEF_BENCH( return new MapPointsMatrixBench("mappts_trans1", make_trans(), true); )
309 DEF_BENCH( return new MapPointsMatrixBench("mappts_scale0", make_scale(), false) ; ) 306 DEF_BENCH( return new MapPointsMatrixBench("mappts_scale0", make_scale(), false) ; )
310 DEF_BENCH( return new MapPointsMatrixBench("mappts_scale1", make_scale(), true); ) 307 DEF_BENCH( return new MapPointsMatrixBench("mappts_scale1", make_scale(), true); )
311 DEF_BENCH( return new MapPointsMatrixBench("mappts_afine0", make_afine(), false) ; ) 308 DEF_BENCH( return new MapPointsMatrixBench("mappts_afine0", make_afine(), false) ; )
312 DEF_BENCH( return new MapPointsMatrixBench("mappts_afine1", make_afine(), true); ) 309 DEF_BENCH( return new MapPointsMatrixBench("mappts_afine1", make_afine(), true); )
313 310
OLDNEW
« no previous file with comments | « no previous file | include/core/SkMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698