# Interpreting @trace dynamic dispatch warning on apply\_type

**URL:** <https://discourse.julialang.org/t/interpreting-trace-dynamic-dispatch-warning-on-apply-type/24138>\
**Category:** Performance\
**Created:** [May 12, 2019, 12:13pm UTC](https://discourse.julialang.org/t/interpreting-trace-dynamic-dispatch-warning-on-apply-type/24138 "2019-05-12T12:13:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![venuur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/venuur/32/6493_2.png) [@venuur](https://discourse.julialang.org/u/venuur)\
**Post date:** [May 12, 2019, 12:13pm UTC](https://discourse.julialang.org/t/interpreting-trace-dynamic-dispatch-warning-on-apply-type/24138/1 "2019-05-12T12:13:26Z")

</div>

New to Julia, and I am trying to build good habits for writing functions. To that end I am applying the Traceur.trace macro to some of my functions and seeing what happens. Here’s an example I don’t understand. When I run

```julia
julia> biasedcoin(p::Float64) = rand(Float64) <= p
julia> @trace biasedcoin(0.5)
┌ Warning: dynamic dispatch to ((Core.apply_type)(Base.Val, x))()
└ @ essentials.jl:683
true

```

This is in Julia Version 1.0.3 (2018-12-18) (intalled using JuliaPro)

Not sure what this means or if there’s anything to do about it. Any idea where to learn more?

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [May 12, 2019, 12:26pm UTC](https://discourse.julialang.org/t/interpreting-trace-dynamic-dispatch-warning-on-apply-type/24138/2 "2019-05-12T12:26:06Z")

</div>

This is within `rand`:

```julia
julia> @trace rand()
┌ Warning: dynamic dispatch to ((Core.apply_type)(Base.Val, x))()
└ @ essentials.jl:728
0.19221794379354495

```

So it is not your fault (but I’m not sure whether it is a problem with `rand` or a false positive).

A side note: whilst it is good to write type-stable functions for performance critical bits, it is also good (and productive) that in Julia you can write non-type-stable functions for the less critical parts. Just separate the two with a function barrier.

Have fun with Julia!

---

<div class="post-metadata">

**Author:** ![venuur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/venuur/32/6493_2.png) [@venuur](https://discourse.julialang.org/u/venuur)\
**Post date:** [May 12, 2019, 9:16pm UTC](https://discourse.julialang.org/t/interpreting-trace-dynamic-dispatch-warning-on-apply-type/24138/3 "2019-05-12T21:16:25Z")

</div>

Thanks for helping and showing me a good a way to identify the source of the warning.

I am looking forward using Julia in a full sized application where I can explore its full range of features.
