Skip to content

Commit 6df38ac

Browse files
author
Andy Ferris
committed
Simplified the benchmark
1 parent 9562d09 commit 6df38ac

File tree

2 files changed

+72
-59
lines changed

2 files changed

+72
-59
lines changed

README.md

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,67 +25,21 @@ out of any uniform Julia "struct".
2525
## Speed
2626

2727
The speed of small `SVector`s, `SMatrix`s and `SArray`s is often > 10 × faster
28-
than `Base.Array`. See this sample benchmark (or see the full results [here](https://github.com/andyferris/StaticArrays.jl/blob/master/perf/bench8.txt)):
28+
than `Base.Array`. See this simplified benchmark (or see the full results [here](https://github.com/andyferris/StaticArrays.jl/blob/master/perf/bench10.txt)):
2929

3030
```
31-
=====================================
32-
Benchmarks for 3×3 matrices
33-
=====================================
34-
35-
Matrix multiplication (8.2x speedup)
36-
------------------------------------
37-
Array -> 2.024568 seconds (74.07 M allocations: 6.623 GB, 9.37% gc time)
38-
SArray -> 0.247364 seconds (5 allocations: 240 bytes)
39-
MArray -> 1.603798 seconds (37.04 M allocations: 2.759 GB, 13.61% gc time)
40-
SizedArray -> 2.223853 seconds (74.07 M allocations: 6.071 GB, 10.05% gc time)
41-
42-
Matrix multiplication (mutating) (3.1x speedup)
43-
-----------------------------------------------
44-
Array -> 1.360940 seconds (6 allocations: 480 bytes)
45-
MArray -> 0.443528 seconds (7 allocations: 400 bytes)
46-
SizedArray -> 0.681896 seconds (7 allocations: 416 bytes)
47-
48-
Matrix addition (45x speedup)
49-
-----------------------------
50-
Array -> 1.458899 seconds (44.44 M allocations: 3.974 GB, 7.96% gc time)
51-
SArray -> 0.032043 seconds (5 allocations: 240 bytes)
52-
MArray -> 0.682318 seconds (22.22 M allocations: 1.656 GB, 18.70% gc time)
53-
SizedArray -> 1.111785 seconds (44.44 M allocations: 3.643 GB, 12.02% gc time)
54-
55-
Matrix addition (mutating) (5.1x speedup)
56-
-----------------------------------------
57-
Array -> 0.493796 seconds (5 allocations: 320 bytes)
58-
MArray -> 0.096303 seconds (5 allocations: 240 bytes)
59-
SizedArray -> 0.135803 seconds (6 allocations: 336 bytes)
60-
61-
Matrix determinant (170x speedup)
62-
---------------------------------
63-
Array -> 15.291557 seconds (222.22 M allocations: 12.694 GB, 16.97% gc time)
64-
SArray -> 0.094409 seconds (4 allocations: 160 bytes)
65-
MArray -> 0.089569 seconds (4 allocations: 160 bytes)
66-
SizedArray -> 0.114134 seconds (4 allocations: 160 bytes)
67-
68-
Matrix inverse (125x speedup)
69-
-----------------------------
70-
Array -> 47.704314 seconds (407.41 M allocations: 82.232 GB, 23.67% gc time)
71-
SArray -> 0.379657 seconds (4 allocations: 160 bytes)
72-
MArray -> 1.294672 seconds (37.04 M allocations: 2.759 GB, 19.77% gc time)
73-
SizedArray -> 2.136363 seconds (74.07 M allocations: 6.071 GB, 8.61% gc time)
74-
75-
Matrix symmetric eigenvalue (105x speedup)
76-
------------------------------------------
77-
Array -> 418.304283 seconds (740.74 M allocations: 89.407 GB, 1.22% gc time)
78-
SArray -> 3.963118 seconds (5 allocations: 256 bytes)
79-
MArray -> 3.964029 seconds (6 allocations: 272 bytes)
80-
SizedArray -> 4.028497 seconds (6 allocations: 208 bytes)
81-
82-
Matrix Cholesky (23.6x speedup)
83-
-------------------------------
84-
Array -> 8.139431 seconds (222.22 M allocations: 9.934 GB, 6.28% gc time)
85-
SArray -> 0.344283 seconds (5 allocations: 256 bytes)
86-
MArray -> 0.812532 seconds (37.04 M allocations: 2.759 GB, 6.19% gc time)
87-
SizedArray -> 2.225999 seconds (74.07 M allocations: 6.071 GB, 11.41% gc time)
88-
31+
============================================
32+
Benchmarks for 3×3 Float64 matrices
33+
============================================
34+
35+
Matrix multiplication -> 8.2x speedup
36+
Matrix multiplication (mutating) -> 3.1x speedup
37+
Matrix addition -> 45x speedup
38+
Matrix addition (mutating) -> 5.1x speedup
39+
Matrix determinant -> 170x speedup
40+
Matrix inverse -> 125x speedup
41+
Matrix symmetric eigenvalue -> 105x speedup
42+
Matrix Cholesky decomposition -> 23.6x speedup
8943
```
9044

9145
(Run with `julia -O3` for even faster SIMD code with immutable static arrays!)

perf/bench10.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
10 November 2016
2+
3+
=====================================
4+
Benchmarks for 3×3 matrices
5+
=====================================
6+
7+
Matrix multiplication (8.2x speedup)
8+
------------------------------------
9+
Array -> 2.024568 seconds (74.07 M allocations: 6.623 GB, 9.37% gc time)
10+
SArray -> 0.247364 seconds (5 allocations: 240 bytes)
11+
MArray -> 1.603798 seconds (37.04 M allocations: 2.759 GB, 13.61% gc time)
12+
SizedArray -> 2.223853 seconds (74.07 M allocations: 6.071 GB, 10.05% gc time)
13+
14+
Matrix multiplication (mutating) (3.1x speedup)
15+
-----------------------------------------------
16+
Array -> 1.360940 seconds (6 allocations: 480 bytes)
17+
MArray -> 0.443528 seconds (7 allocations: 400 bytes)
18+
SizedArray -> 0.681896 seconds (7 allocations: 416 bytes)
19+
20+
Matrix addition (45x speedup)
21+
-----------------------------
22+
Array -> 1.458899 seconds (44.44 M allocations: 3.974 GB, 7.96% gc time)
23+
SArray -> 0.032043 seconds (5 allocations: 240 bytes)
24+
MArray -> 0.682318 seconds (22.22 M allocations: 1.656 GB, 18.70% gc time)
25+
SizedArray -> 1.111785 seconds (44.44 M allocations: 3.643 GB, 12.02% gc time)
26+
27+
Matrix addition (mutating) (5.1x speedup)
28+
-----------------------------------------
29+
Array -> 0.493796 seconds (5 allocations: 320 bytes)
30+
MArray -> 0.096303 seconds (5 allocations: 240 bytes)
31+
SizedArray -> 0.135803 seconds (6 allocations: 336 bytes)
32+
33+
Matrix determinant (170x speedup)
34+
---------------------------------
35+
Array -> 15.291557 seconds (222.22 M allocations: 12.694 GB, 16.97% gc time)
36+
SArray -> 0.094409 seconds (4 allocations: 160 bytes)
37+
MArray -> 0.089569 seconds (4 allocations: 160 bytes)
38+
SizedArray -> 0.114134 seconds (4 allocations: 160 bytes)
39+
40+
Matrix inverse (125x speedup)
41+
-----------------------------
42+
Array -> 47.704314 seconds (407.41 M allocations: 82.232 GB, 23.67% gc time)
43+
SArray -> 0.379657 seconds (4 allocations: 160 bytes)
44+
MArray -> 1.294672 seconds (37.04 M allocations: 2.759 GB, 19.77% gc time)
45+
SizedArray -> 2.136363 seconds (74.07 M allocations: 6.071 GB, 8.61% gc time)
46+
47+
Matrix symmetric eigenvalue (105x speedup)
48+
------------------------------------------
49+
Array -> 418.304283 seconds (740.74 M allocations: 89.407 GB, 1.22% gc time)
50+
SArray -> 3.963118 seconds (5 allocations: 256 bytes)
51+
MArray -> 3.964029 seconds (6 allocations: 272 bytes)
52+
SizedArray -> 4.028497 seconds (6 allocations: 208 bytes)
53+
54+
Matrix Cholesky (23.6x speedup)
55+
-------------------------------
56+
Array -> 8.139431 seconds (222.22 M allocations: 9.934 GB, 6.28% gc time)
57+
SArray -> 0.344283 seconds (5 allocations: 256 bytes)
58+
MArray -> 0.812532 seconds (37.04 M allocations: 2.759 GB, 6.19% gc time)
59+
SizedArray -> 2.225999 seconds (74.07 M allocations: 6.071 GB, 11.41% gc time)

0 commit comments

Comments
 (0)