Skip to content

Commit

Permalink
Follow JuliaFormatter conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
willow-ahrens committed Dec 23, 2024
1 parent 519d2d1 commit aced640
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ end
Substitute symbols in `expr` using substitutions in `old_new`.
"""
substitute_syms(ex, _...) = ex
substitute_syms(ex::Symbol, old_new::Dict{Symbol, Symbol}) = get(old_new, ex, ex)
function substitute_syms(ex::Expr, old_new::Dict{Symbol, Symbol})
substitute_syms(ex::Symbol, old_new::Dict{Symbol,Symbol}) = get(old_new, ex, ex)
function substitute_syms(ex::Expr, old_new::Dict{Symbol,Symbol})
if ex.head !== :quote
return Expr(ex.head, map(x -> substitute_syms(x, old_new), ex.args)...)
else
Expand Down Expand Up @@ -536,7 +536,9 @@ function generate_benchmark_definition(
eval_module, out_vars, setup_vars, quote_vars, quote_vals, core, setup, teardown, params
)
@nospecialize
normalize_syms = Dict{Symbol, Symbol}(map(((i, var),) -> var => Symbol(:__normal_sym__, i), enumerate(quote_vars)))
normalize_syms = Dict{Symbol,Symbol}(
map(((i, var),) -> var => Symbol(:__normal_sym__, i), enumerate(quote_vars))
)
#We cache the generated benchmark function to avoid recompiling it every time.
#We use several keys to cache the generated benchmark function.
#Because out_vars and setup_vars are derived from core and setup, we do not
Expand All @@ -548,7 +550,7 @@ function generate_benchmark_definition(
substitute_syms(core, normalize_syms),
substitute_syms(setup, normalize_syms),
substitute_syms(teardown, normalize_syms),
length(quote_vars)
length(quote_vars),
]
samplefunc = get!(cache, samplefunc_key) do
corefunc = gensym("core")
Expand Down Expand Up @@ -624,7 +626,7 @@ function generate_benchmark_definition(
end,
)
end
Benchmark(samplefunc, quote_vals, params)
return Benchmark(samplefunc, quote_vals, params)
end

######################
Expand Down

0 comments on commit aced640

Please sign in to comment.