Skip to content

Commit

Permalink
Move donotdelete definition to compat (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner authored Nov 27, 2024
1 parent 8293886 commit 154b06a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/benchmarking.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using Random: randperm

# Validation
@static if v"1.8" <= VERSION
const donotdelete = Base.donotdelete
else
const CHECKSUM = Ref{UInt}()
donotdelete(x) = (CHECKSUM[] = hash(x, CHECKSUM[]); nothing)
end

benchmark(f; kw...) = benchmark(nothing, f; kw...)
benchmark(setup, f, teardown=nothing; kw...) = benchmark(nothing, setup, f, teardown; kw...)
benchmark(init, setup, f, teardown; kw...) = only(benchmark(init, setup, (f,), teardown; kw...))
Expand Down
3 changes: 3 additions & 0 deletions src/compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
if VERSION < v"1.8"
cumulative_compile_timing(x) = nothing
cumulative_compile_time_ns() = (UInt64(0), UInt64(0))
const CHECKSUM = Ref{UInt}()
donotdelete(x) = (CHECKSUM[] = hash(x, CHECKSUM[]); nothing)
else
cumulative_compile_timing(x) = Base.cumulative_compile_timing(x)
cumulative_compile_time_ns() = Base.cumulative_compile_time_ns()
const donotdelete = Base.donotdelete
end
if VERSION < v"1.7"
struct Returns{T} <: Function
Expand Down

0 comments on commit 154b06a

Please sign in to comment.