Escaping symbols in a call to `@benchmarkable`


I am trying to create some benchmarks for the MixedModels package using BenchmarkTools. The instructions emphasize that you need to be careful about escaping symbols in a call to @benchmarkable but apparently I am not being careful enough. My current code is

A call to fitlmm should have two symbols and a string like

julia> @benchmark fitlmm(:Animal, "1+(1|G)+(1|H)", :LN_BOBYQA) seconds=1
  memory estimate:  135.95 KiB
  allocs estimate:  2602
  minimum time:     849.243 μs (0.00% GC)
  median time:      863.792 μs (0.00% GC)
  mean time:        905.967 μs (3.51% GC)
  maximum time:     7.211 ms (80.99% GC)
  samples:          1101
  evals/sample:     1

but the current code croaks on tune!(suite) with

UndefVarError: Animal not defined

Can someone suggest a workaround?



@benchmarkable fitlmm($(QuoteNode(k)), $vi, $(QuoteNode(opt)))


Seems to do the trick, thanks.