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

Side by Side Diff: bench/MathBench.cpp

Issue 2012333003: Clean up SkFloatBits (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: member Created 4 years, 6 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 | gyp/core.gypi » ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFixed.h" 10 #include "SkFixed.h"
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 600
601 DEF_BENCH( return new FloorBench(false); ) 601 DEF_BENCH( return new FloorBench(false); )
602 DEF_BENCH( return new FloorBench(true); ) 602 DEF_BENCH( return new FloorBench(true); )
603 603
604 DEF_BENCH( return new CLZBench(false); ) 604 DEF_BENCH( return new CLZBench(false); )
605 DEF_BENCH( return new CLZBench(true); ) 605 DEF_BENCH( return new CLZBench(true); )
606 606
607 DEF_BENCH( return new NormalizeBench(); ) 607 DEF_BENCH( return new NormalizeBench(); )
608 608
609 DEF_BENCH( return new FixedMathBench(); ) 609 DEF_BENCH( return new FixedMathBench(); )
610
611
612 struct FloatToIntBench : public Benchmark {
613 enum { N = 1000000 };
614 float fFloats[N];
615 int fInts [N];
616
617 const char* onGetName() override { return "float_to_int"; }
618 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
619
620 void onDelayedSetup() override {
621 const auto f32 = 4294967296.0f;
622 for (int i = 0; i < N; ++i) {
623 fFloats[i] = -f32 + i*(2*f32/N);
624 }
625 }
626
627 void onDraw(int loops, SkCanvas*) override {
628 while (loops --> 0) {
629 for (int i = 0; i < N; i++) {
630 fInts[i] = SkFloatToIntFloor(fFloats[i]);
631 }
632 }
633 }
634 };
635 DEF_BENCH( return new FloatToIntBench; )
OLDNEW
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698