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})
OperationTensorArraySpeedupSArraySpeedup
Single contraction
a ⊡ a3.134 ns8.030 ns×2.63.134 ns×1.0
A ⊡ a3.485 ns48.342 ns×14.03.485 ns×1.0
S ⊡ a3.485 ns48.413 ns×14.03.485 ns×1.0
Double contraction
A ⊡₂ A3.485 ns10.156 ns×2.93.485 ns×1.0
S ⊡₂ S3.485 ns9.172 ns×2.63.485 ns×1.0
AA ⊡₂ A11.649 ns68.484 ns×5.98.561 ns×0.73
SS ⊡₂ S4.516 ns61.326 ns×14.04.446 ns×0.98
Tensor product
a ⊗ a3.835 ns31.255 ns×8.13.485 ns×0.91
Cross product
a × a3.485 ns18.886 ns×5.43.485 ns×1.0
Determinant
det(A)3.485 ns175.000 ns×50.03.485 ns×1.0
det(S)3.825 ns171.079 ns×45.03.485 ns×0.91
Inverse
inv(A)6.589 ns413.337 ns×63.08.632 ns×1.3
inv(S)4.556 ns404.242 ns×89.08.622 ns×1.9
inv(AA)1.065 μs1.507 μs×1.41.076 μs×1.0
inv(SS)416.603 ns879.314 ns×2.1407.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)