InterestRates.jl icon indicating copy to clipboard operation
InterestRates.jl copied to clipboard

FlatForward optimization

Open felipenoris opened this issue 10 years ago • 2 comments

Why is FlatForward so slow ?

Running perftests...
InterestRates.Linear()
  0.002381 seconds (100 allocations: 1.160 MiB)
  0.017299 seconds (699.10 k allocations: 12.984 MiB)
  0.022000 seconds (699.10 k allocations: 12.984 MiB, 8.02% gc time)
InterestRates.FlatForward()
  0.050725 seconds (1.35 M allocations: 21.759 MiB, 5.55% gc time)
  0.067870 seconds (2.05 M allocations: 33.583 MiB, 7.09% gc time)
  0.060739 seconds (2.05 M allocations: 33.583 MiB, 1.30% gc time)
InterestRates.NelsonSiegel()
  0.014168 seconds (450.10 k allocations: 8.026 MiB, 16.89% gc time)
  0.029529 seconds (1.15 M allocations: 19.850 MiB, 5.20% gc time)
  0.026849 seconds (1.15 M allocations: 19.850 MiB, 5.51% gc time)
InterestRates.Svensson()
  0.011758 seconds (450.10 k allocations: 8.026 MiB)
  0.028876 seconds (1.15 M allocations: 19.850 MiB, 8.81% gc time)
  0.029962 seconds (1.15 M allocations: 19.850 MiB, 6.26% gc time)
InterestRates.CubicSplineOnRates()
  0.005921 seconds (249.00 k allocations: 4.958 MiB)
  0.022034 seconds (948.00 k allocations: 16.782 MiB, 8.80% gc time)
  0.020766 seconds (948.00 k allocations: 16.782 MiB)
InterestRates.CubicSplineOnDiscountFactors()
  0.010648 seconds (450.30 k allocations: 10.345 MiB)
  0.028654 seconds (1.15 M allocations: 22.169 MiB, 7.54% gc time)
  0.029212 seconds (1.15 M allocations: 22.169 MiB, 6.21% gc time)
InterestRates.StepFunction()
  0.001689 seconds (100 allocations: 1.160 MiB)
  0.015189 seconds (699.10 k allocations: 12.984 MiB)
  0.017640 seconds (699.10 k allocations: 12.984 MiB, 11.24% gc time)
Perftests end

felipenoris avatar Sep 21 '15 19:09 felipenoris

It runs much faster as of 11/18/2018. Is this issue still needed?

Running perftests...
InterestRates.FlatForward()
  0.079268 seconds (1.35 M allocations: 21.759 MiB, 3.06% gc time)
  0.107198 seconds (2.05 M allocations: 33.583 MiB, 3.18% gc time)
  0.100127 seconds (2.05 M allocations: 33.583 MiB, 0.58% gc time)

alexandrebrilhante avatar Nov 18 '18 13:11 alexandrebrilhante

@brilhana , you're right. I just updated the results. But my point is about FlatForward relative to other interpolations.

felipenoris avatar Nov 18 '18 13:11 felipenoris