|
29 | 29 | # execution #
|
30 | 30 | #############
|
31 | 31 | # Note that trials executed via `run` and `lineartrial` are always executed at the top-level
|
32 |
| -# scope of the module returned by `current_module()`. This is to avoid any weird quirks |
| 32 | +# scope of the module returned by `@__MODULE__`. This is to avoid any weird quirks |
33 | 33 | # when calling the experiment from within other contexts.
|
34 | 34 |
|
35 | 35 | sample(b::Benchmark, args...) = error("no execution method defined on type $(typeof(b))")
|
36 | 36 | _run(b::Benchmark, args...; kwargs...) = error("no execution method defined on type $(typeof(b))")
|
37 | 37 |
|
38 | 38 | # return (Trial, result) tuple, where result is the result of the benchmarked expression
|
39 | 39 | function run_result(b::Benchmark, p::Parameters = b.params; kwargs...)
|
40 |
| - return eval(current_module(), :(BenchmarkTools._run($(b), $(p); $(kwargs...)))) |
| 40 | + return eval(@__MODULE__, :(BenchmarkTools._run($(b), $(p); $(kwargs...)))) |
41 | 41 | end
|
42 | 42 |
|
43 | 43 | Base.run(b::Benchmark, p::Parameters = b.params; kwargs...) =
|
@@ -72,7 +72,7 @@ function _lineartrial(b::Benchmark, p::Parameters = b.params; maxevals = RESOLUT
|
72 | 72 | end
|
73 | 73 |
|
74 | 74 | function lineartrial(b::Benchmark, p::Parameters = b.params; kwargs...)
|
75 |
| - return eval(current_module(), :(BenchmarkTools._lineartrial($(b), $(p); $(kwargs...)))) |
| 75 | + return eval(@__MODULE__, :(BenchmarkTools._lineartrial($(b), $(p); $(kwargs...)))) |
76 | 76 | end
|
77 | 77 |
|
78 | 78 | warmup(item; verbose::Bool = true) = run(item; verbose = verbose, samples = 1, evals = 1,
|
@@ -250,7 +250,7 @@ macro benchmarkable(args...)
|
250 | 250 |
|
251 | 251 | # generate the benchmark definition
|
252 | 252 | return esc(quote
|
253 |
| - BenchmarkTools.generate_benchmark_definition(current_module(), |
| 253 | + BenchmarkTools.generate_benchmark_definition(@__MODULE__, |
254 | 254 | $(Expr(:quote, out_vars)),
|
255 | 255 | $(Expr(:quote, setup_vars)),
|
256 | 256 | $(Expr(:quote, core)),
|
|
0 commit comments