# Performance

# How does EJML compare?

There are several issues to consider when selecting a linear algebra library; runtime speed, memory consumption, and stability. All three are very important but speed tends to get the most attention. Java Matrix Benchmark was developed at the same time as EJML and is used to evaluate the most popular linear algebra libraries written in Java. The general takeaway from those results is that EJML is one of the fastest single threaded libraries and in many instances is competitive with multi-threaded libraries. It is among the most stable and more memory efficient too.

[summary.png]

# Fastest Interface?

Another question when using EJML is: *Which interface should I use for high performance computing?* In general you can get the most performance out of the procedural interface. However, there are times that the added complexity of using that interface isn't worth it. For example, if you are working with very large matrices the object oriented [SimpleMatrix] is almost as fast. Below are benchmarking results comparing the different interfaces in BoofCV.

## Relative Runtime Plots

Results are presented using relative runtime plots. These plots show how fast each interface is relative to the other. The fastest interface at each matrix size always has a value of one since it can perform the most operations per second. For more information see the Java Matrix Benchmark manual here.

Looking at the addition plot, SimpleMatrix runs at about 0.25 times the speed as using DenseMatrix64F for smaller matrices. When it processes larger matrices it runs at about 0.6 times the speed of the operations interface. This means that for larger matrices it runs relative faster. For more expensive operations (SVD, solve, matrix multiplication, etc ) it is clear that the difference in performance is not significant for matrices that are 100 by 100 or larger.

EJML is EJML using the operations interface and SEJML is EJML using SimpleMatrix.

## Test Environment

Date | July 4, 2010 |
---|---|

OS | Vista 64bit |

CPU | Q9400 - 2.66 Ghz - 4 cores |

JVM | Java HotSpot?(TM) 64-Bit Server VM 1.6.0_16 |

Benchmark | 0.7pre |

EJML | 0.14pre |

TODO recompute these results with Equations and move the files to a local directory