Skip to content

Commit af35d05

Browse files
KristofferCararslan
authored andcommitted
force specialization on arguments to core wrapper (#124)
1 parent e3af54b commit af35d05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/execution.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
276276
id = Expr(:quote, gensym("benchmark"))
277277
corefunc = gensym("core")
278278
samplefunc = gensym("sample")
279+
type_vars = [gensym() for i in 1:length(setup_vars)]
279280
signature = Expr(:call, corefunc, setup_vars...)
281+
signature_def = Expr(:where, Expr(:call, corefunc,
282+
[Expr(:(::), setup_var, type_var) for (setup_var, type_var) in zip(setup_vars, type_vars)]...)
283+
, type_vars...)
280284
if length(out_vars) == 0
281285
invocation = signature
282286
core_body = core
@@ -290,7 +294,7 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
290294
core_body = :($(core); $(returns))
291295
end
292296
return Core.eval(eval_module, quote
293-
@noinline $(signature) = begin $(core_body) end
297+
@noinline $(signature_def) = begin $(core_body) end
294298
@noinline function $(samplefunc)(__params::$BenchmarkTools.Parameters)
295299
$(setup)
296300
__evals = __params.evals

0 commit comments

Comments
 (0)