Skip to content

Instantly share code, notes, and snippets.

@moustachio-belvedere
Last active May 21, 2020 09:44
Show Gist options
  • Save moustachio-belvedere/ec397a68a8aa69bb0d496423032326ce to your computer and use it in GitHub Desktop.
Save moustachio-belvedere/ec397a68a8aa69bb0d496423032326ce to your computer and use it in GitHub Desktop.
using MittagLeffler
using SpecialFunctions
using FunctionWrappers: FunctionWrapper
using QuadGK
using BenchmarkTools
timesingle = 0.5
cₐ, a, cᵦ, β = (1.0, 1.0, 1.0, 0.0)
G(t) = cᵦ*t^(-β)*mittleff((a - β), (1 - β), -cᵦ*t^(a - β)/cₐ)
Gfw = FunctionWrapper{Float64, Tuple{Float64}}((t) -> G(t))
# always works
valsG = G(timesingle)
# always works
valsGfw = Gfw(timesingle)
timevec = collect(0.0:1.0:1000);
@btime G($timesingle) # 359.859 ns (13 allocations: 208 bytes)
@btime Gfw($timesingle) # 482.159 ns (15 allocations: 240 bytes)
@btime G.($timevec) # 398.987 μs (13507 allocations: 219.06 KiB)
@btime Gfw.($timevec) # 444.490 μs (13016 allocations: 211.39 KiB)
println("benchmarks done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment