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 | 2.785 ns | 8.955 ns | ×3.2 | 3.396 ns | ×1.2 |
A ⊡ a | 3.095 ns | 49.739 ns | ×16.0 | 3.396 ns | ×1.1 |
S ⊡ a | 3.096 ns | 49.556 ns | ×16.0 | 3.396 ns | ×1.1 |
| Double contraction | |||||
A ⊡₂ A | 3.706 ns | 10.800 ns | ×2.9 | 3.396 ns | ×0.92 |
S ⊡₂ S | 3.396 ns | 9.878 ns | ×2.9 | 3.396 ns | ×1.0 |
AA ⊡₂ A | 7.752 ns | 68.344 ns | ×8.8 | 7.722 ns | ×1.0 |
SS ⊡₂ S | 4.097 ns | 59.408 ns | ×15.0 | 4.217 ns | ×1.0 |
| Tensor product | |||||
a ⊗ a | 3.406 ns | 28.203 ns | ×8.3 | 3.406 ns | ×1.0 |
| Cross product | |||||
a × a | 3.396 ns | 15.028 ns | ×4.4 | 3.095 ns | ×0.91 |
| Determinant | |||||
det(A) | 3.095 ns | 162.031 ns | ×52.0 | 3.095 ns | ×1.0 |
det(S) | 3.396 ns | 170.035 ns | ×50.0 | 3.095 ns | ×0.91 |
| Inverse | |||||
inv(A) | 6.241 ns | 435.005 ns | ×70.0 | 7.410 ns | ×1.2 |
inv(S) | 4.879 ns | 464.337 ns | ×95.0 | 7.410 ns | ×1.5 |
inv(AA) | 976.812 ns | 1.550 μs | ×1.6 | 971.833 ns | ×0.99 |
inv(SS) | 386.187 ns | 979.091 ns | ×2.5 | 364.515 ns | ×0.94 |
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 7763 64-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)