# Function calls in global scope, benchmarking, etc

**URL:** <https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 13, 2019, 9:07pm UTC](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513 "2019-08-13T21:07:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [August 13, 2019, 9:17pm UTC](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513/2 "2019-08-13T21:17:36Z")

</div>

The goal of BenchmarkTools is to assess the runtime of a function as though it were written that way _inside another function_. The trouble is that when you write `sin(x)`, it’s not clear whether `x` is a global (and slow, see the very first bullet of the [performance tips]) or a local variable. The special `$` flag is how BenchmarkTools can distinguish these two cases. The same thing goes when you write `sin(0.5)` — that 0.5 could be a hard-coded constant (and eligible for constant propagation) or a random choice of a variable.

As far as what the cost will be when running from the REPL, if you can see the difference between 20ns and 5ns, I’ve got a bridge to sell you. The true latency there is more impacted by the amount of time it takes to hit enter, parse, eval, and print than the actual computation.

---

_[View the full topic](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513)._
