Benchmarks
The CI-generated table below compares common small-tensor operations for Tensor, Array, and SArray. It is meant to show that Tensorial stays in the same small-tensor performance range as SArray while working directly with tensor types.
For fourth-order tensor baselines, the Array and SArray implementations use the classical Voigt form so that symmetries are handled correctly. Tensorial performs the same operations on tensor types directly, without manually converting formulas to Voigt form.
a = rand(Vec{3})
A = rand(SecondOrderTensor{3})
S = rand(SymmetricSecondOrderTensor{3})
AA = rand(FourthOrderTensor{3})
SS = rand(SymmetricFourthOrderTensor{3})| Operation | Tensor | Array | Speedup | SArray | Speedup |
|---|---|---|---|---|---|
| Single contraction | |||||
a ⊡ a | 3.134 ns | 8.030 ns | ×2.6 | 3.134 ns | ×1.0 |
A ⊡ a | 3.485 ns | 48.342 ns | ×14.0 | 3.485 ns | ×1.0 |
S ⊡ a | 3.485 ns | 48.413 ns | ×14.0 | 3.485 ns | ×1.0 |
| Double contraction | |||||
A ⊡₂ A | 3.485 ns | 10.156 ns | ×2.9 | 3.485 ns | ×1.0 |
S ⊡₂ S | 3.485 ns | 9.172 ns | ×2.6 | 3.485 ns | ×1.0 |
AA ⊡₂ A | 11.649 ns | 68.484 ns | ×5.9 | 8.561 ns | ×0.73 |
SS ⊡₂ S | 4.516 ns | 61.326 ns | ×14.0 | 4.446 ns | ×0.98 |
| Tensor product | |||||
a ⊗ a | 3.835 ns | 31.255 ns | ×8.1 | 3.485 ns | ×0.91 |
| Cross product | |||||
a × a | 3.485 ns | 18.886 ns | ×5.4 | 3.485 ns | ×1.0 |
| Determinant | |||||
det(A) | 3.485 ns | 175.000 ns | ×50.0 | 3.485 ns | ×1.0 |
det(S) | 3.825 ns | 171.079 ns | ×45.0 | 3.485 ns | ×0.91 |
| Inverse | |||||
inv(A) | 6.589 ns | 413.337 ns | ×63.0 | 8.632 ns | ×1.3 |
inv(S) | 4.556 ns | 404.242 ns | ×89.0 | 8.622 ns | ×1.9 |
inv(AA) | 1.065 μs | 1.507 μs | ×1.4 | 1.076 μs | ×1.0 |
inv(SS) | 416.603 ns | 879.314 ns | ×2.1 | 407.210 ns | ×0.98 |
The benchmarks are generated by runbenchmarks.jl on the following system:
julia> versioninfo()
Julia Version 1.12.6
Commit 15346901f00 (2026-04-09 19:20 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × AMD EPYC 9V74 80-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)