Skip to content

Benchmarks

gsax is benchmarked against SALib on a coupled-oscillator model with varying output shapes. All timings are post-JIT (steady-state), best of 5 iterations, on the same hardware and data.

Results

The benchmark evaluates three methods — analyze (Sobol, first/total order only), analyze (Sobol with second-order), and analyze_hdmr — across four output-shape scenarios, with and without bootstrap confidence intervals.

Machine: Apple M3 Pro, CPU only (no GPU), JAX 0.5.x, Python 3.12.

Sobol — no bootstrap

Scenario (T×K)Methodgsax (ms)SALib (ms)Speedup
1×1analyze (no S2)0.80.20.3×
1×1analyze (S2)0.90.91.0×
1×6analyze (no S2)1.01.41.4×
1×6analyze (S2)1.55.33.5×
50×1analyze (no S2)2.812.34.4×
50×1analyze (S2)4.945.89.4×
50×6analyze (no S2)8.874.38.5×
50×6analyze (S2)14.8276.618.7×

Sobol — 300 bootstrap resamples

Scenario (T×K)Methodgsax (ms)SALib (ms)Speedup
1×1analyze (no S2)5.228.55.5×
1×1analyze (S2)8.580.09.4×
1×6analyze (no S2)17.0162.89.6×
1×6analyze (S2)36.4490.513.5×
50×1analyze (no S2)121.71434.911.8×
50×1analyze (S2)280.64142.014.8×
50×6analyze (no S2)726.19384.212.9×
50×6analyze (S2)1666.726596.816.0×

HDMR

Scenario (T×K)Methodgsax (ms)SALib (ms)Speedup
1×1analyze_hdmr17.689.55.1×
1×6analyze_hdmr19.0508.626.7×
50×1analyze_hdmr22.33990.5178.7×
50×6analyze_hdmr37.028345.8766.3×

Why gsax is faster

SALib processes each (t, k) output slice in a Python loop. For a 50-timestep × 6-output model, that's 300 sequential calls to the Sobol analyzer.

gsax uses:

  • Fused kernels that compute the pooled variance once and derive all S1, ST, and S2 indices from it (instead of recomputing it D×2 times per output).
  • Vectorized execution via jax.vmap over all T×K output combinations in a single compiled pass.
  • Scalar fast-path for T×K=1 that bypasses vmap overhead entirely.
  • JIT compilation so repeated calls (e.g. bootstrap resamples or parameter sweeps) run at native speed.

The speedup grows with T×K because SALib's per-slice overhead is linear while gsax's vectorized cost is nearly flat. With bootstrap enabled, JIT compilation pays off even more — resampled analyses reuse the same compiled kernel, while SALib re-runs pure Python each time.

Benchmark setup

  • Model: Coupled damped oscillators (D=5 parameters, T timepoints, K outputs).
  • Samples: N=1024 base Sobol points (7,168 expanded rows for first/total; 12,288 for second-order).
  • Bootstrap: 300 resamples for the bootstrap tables; no bootstrap for the base tables.
  • HDMR: maxorder=2, m=2, same N=1024 random samples.
  • Correctness: Validated against analytical Ishigami solutions (D=3, N=16384) and SALib on the same data.

Reproducing

The full benchmark script is at benchmark_salib.py in the repository root. Run it locally:

bash
uv run python benchmark_salib.py

It first runs correctness checks (Ishigami function, exact match with SALib), then prints the timing table above. Your numbers will vary by hardware.

Released under the MIT License.