From 40636a53037eadd957b8e43f0961f640aaa93e84 Mon Sep 17 00:00:00 2001 From: reed Date: Fri, 10 Oct 2014 05:50:15 -0700 Subject: faster SkRect::sort BUG=skia: Review URL: https://codereview.chromium.org/646863002 --- bench/GeometryBench.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bench/GeometryBench.cpp') diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp index cd58e3cdaf..a5c4643f9e 100644 --- a/bench/GeometryBench.cpp +++ b/bench/GeometryBench.cpp @@ -97,7 +97,7 @@ protected: class GeoRectBench_Intersects : public GeoRectBench { public: GeoRectBench_Intersects() : GeoRectBench("rect_Intersects") {} - + protected: virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { for (int outer = 0; outer < loops; ++outer) { @@ -110,6 +110,22 @@ protected: } }; +class GeoRectBench_sort : public GeoRectBench { +public: + GeoRectBench_sort() : GeoRectBench("rect_sort") {} + +protected: + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { + for (int outer = 0; outer < loops; ++outer) { + for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) { + fRects[i].sort(); + } + } + } +}; + DEF_BENCH( return new GeoRectBench_intersect; ) DEF_BENCH( return new GeoRectBench_intersect_rect; ) DEF_BENCH( return new GeoRectBench_Intersects; ) + +DEF_BENCH( return new GeoRectBench_sort; ) -- cgit v1.2.3