# special::Type{MAGIC} where MAGIC

**URL:** <https://discourse.julialang.org/t/special-type-magic-where-magic/5424>\
**Category:** General Usage\
**Created:** [August 17, 2017, 1:13pm UTC](https://discourse.julialang.org/t/special-type-magic-where-magic/5424 "2017-08-17T13:13:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [August 17, 2017, 1:13pm UTC](https://discourse.julialang.org/t/special-type-magic-where-magic/5424/1 "2017-08-17T13:13:41Z")

</div>

Is the `foo(::Type{M}) where M` trick documented anywhere in the docs? I looked around and couldn’t find anything. I keep feeling like I know what’s going on, but then I hit situations like this, on 0.6:

```julia
foo1(t::Type, x) = Nullable{t}(sin(x))
foo2(t::Type{T}, x) where T = Nullable{t}(sin(x))
foo3(t::Type{T}, x) where T = Nullable{T}(sin(x))

@btime foo1(Float64, 2)
  408.815 ns (2 allocations: 48 bytes)
@btime foo2(Float64, 2)
  17.359 ns (0 allocations: 0 bytes)
@btime foo3(Float64, 2)
  17.356 ns (0 allocations: 0 bytes)

@btime foo1($Float64, 2)
  499.789 ns (2 allocations: 48 bytes)
@btime foo2($Float64, 2)
  84.436 ns (1 allocation: 32 bytes)
@btime foo3($Float64, 2)
  77.956 ns (1 allocation: 32 bytes)

```

All three methods are `@inferred` correctly and their `@code_warntype/llvm` are AFAICT identical. Then why is `foo1` slower? Why is splicing in the `Float64` type worse?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 17, 2017, 3:15pm UTC](https://discourse.julialang.org/t/special-type-magic-where-magic/5424/2 "2017-08-17T15:15:33Z")

</div>

[https://github.com/JuliaCI/BenchmarkTools.jl/issues/50](https://github.com/JuliaCI/BenchmarkTools.jl/issues/50)
