Skip to content

Commit

Permalink
force specialization on arguments to core wrapper (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored and ararslan committed Oct 22, 2018
1 parent e3af54b commit af35d05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
id = Expr(:quote, gensym("benchmark"))
corefunc = gensym("core")
samplefunc = gensym("sample")
type_vars = [gensym() for i in 1:length(setup_vars)]
signature = Expr(:call, corefunc, setup_vars...)
signature_def = Expr(:where, Expr(:call, corefunc,
[Expr(:(::), setup_var, type_var) for (setup_var, type_var) in zip(setup_vars, type_vars)]...)
, type_vars...)
if length(out_vars) == 0
invocation = signature
core_body = core
Expand All @@ -290,7 +294,7 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
core_body = :($(core); $(returns))
end
return Core.eval(eval_module, quote
@noinline $(signature) = begin $(core_body) end
@noinline $(signature_def) = begin $(core_body) end
@noinline function $(samplefunc)(__params::$BenchmarkTools.Parameters)
$(setup)
__evals = __params.evals
Expand Down

0 comments on commit af35d05

Please sign in to comment.