Skip to content

besselj_zero is not type stable  #16

@itsdfish

Description

@itsdfish

Hi,

Thank you for putting this package together. While using besselj_zero in one of my projects, I noticed some type instability and high allocations. I'm not sure if there are any improvement which can be made.

Thanks!

@benchmark besselj_zero(0, 3)

BenchmarkTools.Trial: 10000 samples with 8 evaluations.
 Range (min … max):  3.780 μs …  1.405 ms  ┊ GC (min … max): 0.00% … 98.96%
 Time  (median):     4.108 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   4.638 μs ± 14.065 μs  ┊ GC (mean ± σ):  3.00% ±  0.99%

  ▄█▇▆▆▅▄▂   ▁▁▁                                             ▂
  █████████▇█████▇▇▆▆▅▆▇██▆▇▆▅▅▅▆▇▇▇▅▆▅▅▅▅▆▅█▇▆▆▇▅▅▆▆▆▅▆▅▅▄▄ █
  3.78 μs      Histogram: log(frequency) by time     10.9 μs <

 Memory estimate: 1.84 KiB, allocs estimate: 45.

@code_warntype besselj_zero(0, 3)

MethodInstance for FunctionZeros.besselj_zero(::Int64, ::Int64)
  from besselj_zero(nu, n; order) @ FunctionZeros ~/.julia/packages/FunctionZeros/7kv6J/src/FunctionZeros.jl:52
Arguments
  #self#::Core.Const(FunctionZeros.besselj_zero)
  nu::Int64
  n::Int64
Body::Any
1 ─ %1 = FunctionZeros.:(var"#besselj_zero#1")(2, #self#, nu, n)::Any
└──      return %1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions