Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance versus quadgk #41

Open
hammerfunctor opened this issue Apr 27, 2022 · 1 comment
Open

Performance versus quadgk #41

hammerfunctor opened this issue Apr 27, 2022 · 1 comment

Comments

@hammerfunctor
Copy link

hammerfunctor commented Apr 27, 2022

Hi, I made some benchmarks and noted that for 1-d integral quadgk is way more fast than hquadrature. Here is a simple example

julia> using HCubature, BenchmarkTools

julia> f() = hquadrature(t -> exp(-t)/t, 1, 100000)
f (generic function with 1 method)

julia> g() = HCubature.QuadGK.quadgk(t -> exp(-t)/t, 1, 100000)
g (generic function with 1 method)

julia> @btime f()
  26.478 μs (1131 allocations: 31.97 KiB)
(0.21938393439552029, 1.3846093405775578e-9)

julia> @btime g()
  10.078 μs (339 allocations: 8.02 KiB)
(0.2193839343955203, 1.3846093658126016e-9)

Is this difference on algorithm level or just because quadgk is internally optimized?

Thanks!

@stevengj
Copy link
Member

stevengj commented Apr 27, 2022

The algorithms (in 1d) are essentially the same; probably there are just some untapped optimization opportunities in HCubature to reduce allocations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants