# What does the beckmarking in global scope mean?

**URL:** https://discourse.julialang.org/t/what-does-the-beckmarking-in-global-scope-mean/80898
**Category:** General Usage
**Tags:** question
**Created:** [May 11, 2022, 4:34pm UTC](https://discourse.julialang.org/t/what-does-the-beckmarking-in-global-scope-mean/80898 "2022-05-11T16:34:46Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)
#### Post date: [May 11, 2022, 5:41pm UTC](https://discourse.julialang.org/t/what-does-the-beckmarking-in-global-scope-mean/80898/7 "2022-05-11T17:41:54Z")

</div>

> [@Function calls in global scope, benchmarking, etc](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513/4):
>
> Ah, I see where the disconnect is. The 4x difference you’re seeing in sin isn’t really a 4x multiple. It’s a ~constant 15ns. In that 15ns, Julia looks up the method table for sin, figures out which method to dispatch to, then calls the appropriate sin(::Float64). The remaining 5ns is actually doing the computation of the sine. If you have a heavy duty computation, calling it from global scope isn’t going to make it run 4x slower. It’ll make it run 15ns slower. The time it takes to do dyna…

- So, this `15ns` is actually consumed during the compilation stage not during the run-time, and since the performance matters during runt-time, so `$` is used, correct?

> [@Function calls in global scope, benchmarking, etc](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513/2):
>
> 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 r…

How can the BenchmarkTools distinguish between these two cases? Does it start to check the performance after the compilation stage is finished, at which the case (type) of variables is known?

---

_[View the full topic](https://discourse.julialang.org/t/what-does-the-beckmarking-in-global-scope-mean/80898)._
