# Why do \`$\`s in BenchmarkTools change allocations so dramatically?

**URL:** <https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779>\
**Category:** General Usage\
**Tags:** memory-allocation\
**Created:** [January 18, 2022, 1:56am UTC](https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779 "2022-01-18T01:56:47Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [January 18, 2022, 6:32pm UTC](https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779/14 "2022-01-18T18:32:11Z")

</div>

So I know you’ve found this thread to be a red-herring on your way to the [more complicated issue](https://discourse.julialang.org/t/this-is-some-serious-magic/74819/) you’re trying to debug, but there is a pretty straightforward answer to how BenchmarkTools uses that `$` syntax. It simply constructs its benchmarking loop such that anything that’s `$`'ed is an _argument_ to the function. Everything else is considered a global. How big of an effect this has is entirely dependent upon what Julia is doing.

In general, you want to make sure all _function-local variables_ in your original example have `$`'s on them in their benchmarks.

---

_[View the full topic](https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779)._
