# Is the type-instability in take!(::RemoteChannel) of practical concern?

**URL:** <https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864>\
**Category:** Performance\
**Tags:** question, distributed\
**Created:** [December 15, 2020, 12:00pm UTC](https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864 "2020-12-15T12:00:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [December 15, 2020, 12:00pm UTC](https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864/1 "2020-12-15T12:00:55Z")

</div>

For example:

```julia
julia> using Distributed

julia> r = RemoteChannel(()->Channel{Bool}(Inf))
RemoteChannel{Channel{Bool}}(1, 1, 1)

julia> @code_warntype take!(r)
Variables
  #self#::Core.Compiler.Const(take!, false)
  rr::RemoteChannel{Channel{Bool}}
  args::Tuple{}

Body::Any
1 ─ %1 = Distributed.myid()::Int64
│ %2 = Core.tuple(Distributed.take_ref, rr, %1)::Core.Compiler.PartialStruct(Tuple{typeof(Distributed.take_ref),RemoteChannel{Channel{Bool}},Int64}, Any[Core.Compiler.Const(Distributed.take_ref, false), RemoteChannel{Channel{Bool}}, Int64])
│ %3 = Core._apply_iterate(Base.iterate, Distributed.call_on_owner, %2, args)::Any
└── return %3

```

I wonder if this type-instability is of concern in practical usage? In this case, for example, it’s known that the elements fetched from the `RemoteChannel` will be of type `Bool`.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [December 15, 2020, 12:15pm UTC](https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864/2 "2020-12-15T12:15:18Z")

</div>

Hmm, I observe the same thing even with `const r` and with `f(x) = take!(x)` 🤔 That’s certainly interesting.
