From 95da3bad060c395418431f204d0e3d36bcee92b7 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 20 Jun 2024 23:03:05 +0100 Subject: [PATCH] Cleanup --- src/execution.jl | 5 ----- src/parameters.jl | 12 ++---------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/execution.jl b/src/execution.jl index 94ebe825..db458ca2 100644 --- a/src/execution.jl +++ b/src/execution.jl @@ -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 )( @@ -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() @@ -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 )( diff --git a/src/parameters.jl b/src/parameters.jl index b2e76236..a8c46512 100644 --- a/src/parameters.jl +++ b/src/parameters.jl @@ -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,