# 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:** 4

<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, 10:12pm UTC](https://discourse.julialang.org/t/function-calls-in-global-scope-benchmarking-etc/27513/4 "2019-08-13T22:12:40Z")

</div>

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 dynamic dispatch isn’t dependent upon the size of the arguments or the total computation time — it’s simply a product of the number of methods of the function you’re calling and will be a very small constant overhead.

---

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