Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed Jun 20, 2024
1 parent fe22190 commit 95da3ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,11 @@ function generate_benchmark_definition(
__prehook_result, __posthook_result, __return_val = $BenchmarkTools.@noinline (
function (__evals)
prehook_result = $BenchmarkTools.samplefunc_prehook()
# We'll run it evals times.
$BenchmarkTools.@noinline __return_val_2 = $(invocation)
for __iter in 2:__evals
$BenchmarkTools.@noinline $(invocation)
end
posthook_result = $BenchmarkTools.samplefunc_posthook()
# trick the compiler not to eliminate the code
return prehook_result, posthook_result, __return_val_2
end
)(
Expand All @@ -655,8 +653,6 @@ function generate_benchmark_definition(
__params
)
$BenchmarkTools.@noinline $(setup)
# 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
__prehook_result, __posthook_result, __return_val = $BenchmarkTools.@noinline (
function (__evals)
prehook_result = __params.prehook()
Expand All @@ -666,7 +662,6 @@ function generate_benchmark_definition(
$BenchmarkTools.@noinline $(invocation)
end
posthook_result = __params.posthook()
# trick the compiler not to eliminate the code
return prehook_result, posthook_result, __return_val_2
end
)(
Expand Down
12 changes: 2 additions & 10 deletions src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,8 @@ function Parameters(
else
default.sample_result
end
params_prehook = if prehook != nothing
prehook
else
default.prehook
end
params_posthook = if posthook != nothing
posthook
else
default.posthook
end
params_prehook = prehook != nothing ? prehook : default.prehook
params_posthook = posthook != nothing ? posthook : default.posthook
return Parameters(
params_seconds,
params_samples,
Expand Down

0 comments on commit 95da3ba

Please sign in to comment.