# Escaping symbols in a call to \`@benchmarkable\`

**URL:** <https://discourse.julialang.org/t/escaping-symbols-in-a-call-to-benchmarkable/3934>\
**Category:** General Usage\
**Created:** [May 25, 2017, 8:30pm UTC](https://discourse.julialang.org/t/escaping-symbols-in-a-call-to-benchmarkable/3934 "2017-05-25T20:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [May 25, 2017, 8:30pm UTC](https://discourse.julialang.org/t/escaping-symbols-in-a-call-to-benchmarkable/3934/1 "2017-05-25T20:30:25Z")

</div>

I am trying to create some benchmarks for the [`MixedModels`](http://github.com/dmbates/MixedModels.jl) 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

[https://github.com/dmbates/MixedModels.jl/blob/termsRefactor/benchmark/runbenchmark.jl](https://github.com/dmbates/MixedModels.jl/blob/termsRefactor/benchmark/runbenchmark.jl)

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

```julia
julia> @benchmark fitlmm(:Animal, "1+(1|G)+(1|H)", :LN_BOBYQA) seconds=1
BenchmarkTools.Trial:
  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

```julia
UndefVarError: Animal not defined

```

Can someone suggest a workaround?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 25, 2017, 8:45pm UTC](https://discourse.julialang.org/t/escaping-symbols-in-a-call-to-benchmarkable/3934/2 "2017-05-25T20:45:53Z")

</div>

Try:

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

```

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [May 25, 2017, 8:59pm UTC](https://discourse.julialang.org/t/escaping-symbols-in-a-call-to-benchmarkable/3934/3 "2017-05-25T20:59:08Z")

</div>

Seems to do the trick, thanks.
