Benchmarks

Comparison of FastTanhSinhQuadrature.jl vs FastGaussQuadrature.jl.

System:

  • CPU: Intel(R) Core(TM) Ultra 7 155U
  • Threads: 1 (Single-threaded execution)

Results

Legend:

  • TS: FastTanhSinhQuadrature.integrate1D
  • TS SIMD: FastTanhSinhQuadrature.integrate1D_avx (using LoopVectorization)
  • GQ: FastGaussQuadrature.gausslegendre
FunctionDomainPointsTS (ns)TS SIMD (ns)GQ (ns)Ratio (TS/GQ)Ratio (TS SIMD/GQ)
exp(x)[-1, 1]533.0914.2733.031.000.43
exp(x)[-1, 1]50322.8781.99176.681.830.46
exp(x)[-1, 1]5003374.75782.081665.502.030.47
sin(x)^2[-1, 1]540.3923.3832.631.240.72
sin(x)^2[-1, 1]50404.32145.48176.752.290.82
sin(x)^2[-1, 1]5004361.711409.101768.402.470.80
1/(1+25x^2)[-1, 1]53.003.7517.350.170.22
1/(1+25x^2)[-1, 1]5041.8239.1734.771.201.13
1/(1+25x^2)[-1, 1]500477.21213.24320.391.490.67
sqrt(1-x^2)[-1, 1]54.064.6920.310.200.23
sqrt(1-x^2)[-1, 1]5068.0145.3169.680.980.65
sqrt(1-x^2)[-1, 1]500636.53313.13743.430.860.42
x^2[-1, 1]52.013.0419.860.100.15
x^2[-1, 1]5017.7221.6838.070.470.57
x^2[-1, 1]500213.3154.97273.190.780.20
log(1-x)[-1, 1]538.0630.2934.321.110.88
log(1-x)[-1, 1]50371.88187.29214.701.730.87
log(1-x)[-1, 1]5004117.381978.802117.801.940.93
x^3[-1, 1]52.233.1418.650.120.17
x^3[-1, 1]5021.8622.0935.690.610.62
x^3[-1, 1]500239.2860.84267.620.890.23
x^3+x^2+x+1[-1, 1]53.984.0020.120.200.20
x^3+x^2+x+1[-1, 1]5041.7526.3136.581.140.72
x^3+x^2+x+1[-1, 1]500450.2280.03263.541.710.30

Analysis

  • Polynomials: FastTanhSinhQuadrature with SIMD acceleration (x^2, x^3) is significantly faster (up to ~3-5x) than Gauss-Legendre quadrature.
  • Singularities: Functions like sqrt(1-x^2) and log(1-x) are handled very efficiently, often matching or outperforming Gaussian quadrature due to the double exponential clustering of nodes.
  • Runge Function: 1/(1+25x^2) also shows competitive performance, especially with SIMD.

In summary, for smooth analytic functions, Gaussian quadrature (standard non-SIMD integrate1D vs GQ) is faster due to fewer nodes required for exactness using polynomials. However, FastTanhSinhQuadrature's SIMD implementation (integrate1D_avx) often bridges or exceeds this gap, and it is the superior choice for singular integrands.

Running Benchmarks

To run the benchmarks yourself:

julia --project=benchmark -e 'include("benchmark/benchmarks.jl"); run_benchmark()'