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

Unified Diff: bench/Matrix44Bench.cpp

Issue 22886010: Add perf benchmarks and more unit tests for matrix inversion (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/Matrix44Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/Matrix44Bench.cpp
===================================================================
--- bench/Matrix44Bench.cpp (revision 10801)
+++ bench/Matrix44Bench.cpp (working copy)
@@ -79,22 +79,22 @@
class InvertMatrix44Bench : public Matrix44Bench {
public:
InvertMatrix44Bench(void* param) : INHERITED(param, "invert") {
- fM0.set(0, 0, -1.1);
- fM0.set(0, 1, 2.1);
- fM0.set(0, 2, -3.1);
- fM0.set(0, 3, 4.1);
- fM0.set(1, 0, 5.1);
- fM0.set(1, 1, -6.1);
- fM0.set(1, 2, 7.1);
- fM0.set(1, 3, 8.1);
- fM0.set(2, 0, -9.1);
- fM0.set(2, 1, 10.1);
- fM0.set(2, 2, 11.1);
- fM0.set(2, 3, -12.1);
- fM0.set(3, 0, -13.1);
- fM0.set(3, 1, 14.1);
- fM0.set(3, 2, -15.1);
- fM0.set(3, 3, 16.1);
+ fM0.set(0, 0, -1.1);
+ fM0.set(0, 1, 2.1);
+ fM0.set(0, 2, -3.1);
+ fM0.set(0, 3, 4.1);
+ fM0.set(1, 0, 5.1);
+ fM0.set(1, 1, -6.1);
+ fM0.set(1, 2, 7.1);
+ fM0.set(1, 3, 8.1);
+ fM0.set(2, 0, -9.1);
+ fM0.set(2, 1, 10.1);
+ fM0.set(2, 2, 11.1);
+ fM0.set(2, 3, -12.1);
+ fM0.set(3, 0, -13.1);
+ fM0.set(3, 1, 14.1);
+ fM0.set(3, 2, -15.1);
+ fM0.set(3, 3, 16.1);
}
protected:
virtual void performTest() {
@@ -107,6 +107,75 @@
typedef Matrix44Bench INHERITED;
};
+class InvertAffineMatrix44Bench : public Matrix44Bench {
+public:
+ InvertAffineMatrix44Bench(void* param) : INHERITED(param, "invertaffine") {
+ fM0.set(0, 0, -1.1);
+ fM0.set(0, 1, 2.1);
+ fM0.set(0, 2, -3.1);
+ fM0.set(0, 3, 4.1);
+ fM0.set(1, 0, 5.1);
+ fM0.set(1, 1, -6.1);
+ fM0.set(1, 2, 7.1);
+ fM0.set(1, 3, 8.1);
+ fM0.set(2, 0, -9.1);
+ fM0.set(2, 1, 10.1);
+ fM0.set(2, 2, 11.1);
+ fM0.set(2, 3, -12.1);
+ // bottom row (perspective component) remains (0, 0, 0, 1).
+ }
+protected:
+ virtual void performTest() {
+ for (int i = 0; i < 10; ++i) {
+ fM0.invert(&fM1);
+ }
+ }
+private:
+ SkMatrix44 fM0, fM1;
+ typedef Matrix44Bench INHERITED;
+};
+
+class InvertScaleTranslateMatrix44Bench : public Matrix44Bench {
+public:
+ InvertScaleTranslateMatrix44Bench(void* param) : INHERITED(param, "invertscaletranslate") {
+ fM0.set(0, 0, -1.1);
+ fM0.set(0, 3, 4.1);
+
+ fM0.set(1, 1, -6.1);
+ fM0.set(1, 3, 8.1);
+
+ fM0.set(2, 2, 11.1);
+ fM0.set(2, 3, -12.1);
+ }
+protected:
+ virtual void performTest() {
+ for (int i = 0; i < 10; ++i) {
+ fM0.invert(&fM1);
+ }
+ }
+private:
+ SkMatrix44 fM0, fM1;
+ typedef Matrix44Bench INHERITED;
+};
+
+class InvertTranslateMatrix44Bench : public Matrix44Bench {
+public:
+ InvertTranslateMatrix44Bench(void* param) : INHERITED(param, "inverttranslate") {
+ fM0.set(0, 3, 4.1);
+ fM0.set(1, 3, 8.1);
+ fM0.set(2, 3, -12.1);
+ }
+protected:
+ virtual void performTest() {
+ for (int i = 0; i < 10; ++i) {
+ fM0.invert(&fM1);
+ }
+ }
+private:
+ SkMatrix44 fM0, fM1;
+ typedef Matrix44Bench INHERITED;
+};
+
class PostScaleMatrix44Bench : public Matrix44Bench {
public:
PostScaleMatrix44Bench(void* param) : INHERITED(param, "postscale") {
@@ -167,5 +236,8 @@
DEF_BENCH( return new PreScaleMatrix44Bench(p); )
DEF_BENCH( return new PostScaleMatrix44Bench(p); )
DEF_BENCH( return new InvertMatrix44Bench(p); )
+DEF_BENCH( return new InvertAffineMatrix44Bench(p); )
+DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(p); )
+DEF_BENCH( return new InvertTranslateMatrix44Bench(p); )
DEF_BENCH( return new SetConcatMatrix44Bench(p); )
DEF_BENCH( return new GetTypeMatrix44Bench(p); )
« no previous file with comments | « no previous file | tests/Matrix44Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698