Package to benchmark different matrix types and operations in Pharo
- Go to Playground (Ctrl+O+W) in your Pharo image.
- Execute the following Metacello script (select it and press Do-it button or Ctrl+D):
EpMonitor disableDuring: [
Metacello new
baseline: 'MatrixBenchmark';
repository: 'github://rakki-18/Matrix-Benchmarks/src';
load ]
In order to supress load warnings, you may prefer
[ Metacello new
baseline: 'MatrixBenchmark';
repository: 'github://rakki-18/Matrix-Benchmarks/src';
load ]
on: MCMergeOrLoadWarning
do: [:warning | warning load ]
MBApplication new start
If you prefer not to run the User-Interface, then you can run the benchmarks programatically using
To run benchmarks on a particular operation for a particular matrix size:
MBOperationName runBenchmarks: matrixSize
To run benchmarks for a particular operation for a set of matrix sizes:
MBOperationName runAllBenchmarks
The range of the matrix sizes on which the benchmarks are run can be customized by:
MBOperationName runAllBenchmarksFrom: fromMatrixSize to: toMatrixSize by: aNumber
To see all the available operations that can be benchmarked:
MBAbstract operations
- On the operation - Addition:
MBAddition runAllBenchmarks.
- On the operation - Element-wise Multiplication
MBElementWiseMultiplication runBenchmarks: 200.
- On the operation - Accessing cells of a matrix for the matrix sizes {50,100,150,200}
MBAccess runAllBenchmarksFrom: 50 to: 200 by: 50
- Array2D
- PMMatrix
- PMSymmetricMatrix
- AIColumnMatrix
- AIRowMatrix
- AISymetricMatrix
- AIDiagonalMatrix
- PMJacobiTransformation
- PMLinearEquationSystem
- PMLUPDecomposition
- Building an empty Matrix
- Building a matrix filled with zeros
- Accessing matrix cells
- Addition of matrices
- Subtraction of matrices
- Matrix Multiplication
- Element-wise Multiplication
- Multiplication with a number
- Division with a number
- Comparing matrices
- Finding determinant
- Finding inverse
- Transpose of a matrx
- Trace of a matrix
- Finding eigenvectors
- Gaussian Elimination
- LU Decomposition
- QR Decomposition
- Rank factorization
- Singular Value Decomposition
- Strassen Multiplication
If you want to add a dependency to your project, include the following lines into your baseline method:
spec
baseline: 'MatrixBenchmark'
with: [ spec repository: 'github://rakki-18/Matrix-Benchmarks/src' ].
Check out Baselines to learn more about baselines.
- Select the matrix operation.
- Select the matrix sizes parameters and execute
- Outputs the benchmark results and plots.