Skip to content

Commit

Permalink
Use @noinline from Compat in linux_perf_func
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed May 2, 2024
1 parent b157449 commit 6b2884f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,16 @@ function generate_benchmark_definition(
)

try
@noinline $(setup)
$BenchmarkTools.@noinline $(setup)
__evals = __params.evals
# Isolate code so that e.g. setup doesn't cause different code to be generated by e.g. changing register allocation
# Unfortunately it still does, e.g. if you define a variable in setup then it's passed into invocation adding a few instructions
@noinline (function (__evals)
$BenchmarkTools.@noinline (function (__evals)
$LinuxPerf.enable_all!()
# We'll run it evals times.
@noinline __return_val_2 = $(invocation)
$BenchmarkTools.@noinline __return_val_2 = $(invocation)
for __iter in 2:__evals
@noinline $(invocation)
$BenchmarkTools.@noinline $(invocation)
end
$LinuxPerf.disable_all!()
# trick the compiler not to eliminate the code
Expand Down

0 comments on commit 6b2884f

Please sign in to comment.