# Why does broadcast operation allocate?

**URL:** <https://discourse.julialang.org/t/why-does-broadcast-operation-allocate/65428>\
**Category:** Performance\
**Created:** [July 28, 2021, 10:58am UTC](https://discourse.julialang.org/t/why-does-broadcast-operation-allocate/65428 "2021-07-28T10:58:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 28, 2021, 11:01am UTC](https://discourse.julialang.org/t/why-does-broadcast-operation-allocate/65428/2 "2021-07-28T11:01:47Z")

</div>

It doesn’t:

```julia
julia> a = rand(241); b = rand(241);

julia> function minuseq!(a,b)
           a .-= b
           nothing
       end
minuseq! (generic function with 1 method)

julia> @time minuseq!(a,b)
  0.046553 seconds (196.53 k allocations: 11.362 MiB, 99.96% compilation time)

julia> @time minuseq!(a,b)
  0.000003 seconds

```

---

_[View the full topic](https://discourse.julialang.org/t/why-does-broadcast-operation-allocate/65428)._
