Skip to content

Unexpected Behaviour of @btime - cubic splines evaluation #299

@cortner

Description

@cortner

The oddest thing happens when I benchmark gradient1 for cubic splines in Interpolations.jl:

The following benchmark script

using Interpolations, ForwardDiff 
rr = range(0.0, stop=5.0, length=10_000)
spl = cubic_spline_interpolation(rr, sin.(rr))
r = rand() * 5
print(" gradient1: "); @btime Interpolations.gradient1($spl, $r)
@btime Interpolations.gradient1($spl, $r)

produces output

 gradient1:   12.345 ns (0 allocations: 0 bytes)
  56.682 ns (0 allocations: 0 bytes)

System info:

julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf26 (2022-09-29 15:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.6.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 8 on 8 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8

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