Translation ruleset and priority
PerfTest.jl translates a declarative recipe file for performance tests into a Julia expression that can actually execute them. The traslation prodedure is done by walking through the recipe code whilst trying to do pattern matching with a set of translation rules. The translation rules are totally ordered, which means that there is a clear hierarchy on which pattern is translated in case an expression fits two patterns at the same time. Below there is a full list of the rules, in decreasing order by priority. Given the way the macros in the package are declared there should not be ambiguous pattern matching but for further safety the priority is enforced.
- @testset macro
- @test macro
- @test_throws macro
- @test_logs macro
- @inferred macro
- @test_deprecated macro
- @test_warn macro
- @test_nowarn macro
- @test_broken macro
- @test_skip macro
- @perftest macro
- Back context token, internal use only
- Prefix placement token, internal use only
- Suffix placement token, internal use only
- @config macro
- @on_perftest_exec macro
- @on_perftest_ignore macro
- @define_eff_memory_throughput macro
- @define_metric macro
- @define_benchmark macro
- @roofline macro
- @auxiliary_metric macro
- @perfcompare macro
- Recursivity rule, used for includes inside testsets
Inside a @perftest macro the expression has to be manipulated to be able tu use local variables in a global context (a requirement of BenchmarkTools.jl). The rules have the following priority:
- Assignment pattern rule: a = b
- Function argument pattern rule: f(arg)
- Vectorized function call pattern rule: f.(arg)
- Dot operator pattern rule: a.b