# How much of a difference does avoiding allocations make?

**URL:** <https://discourse.julialang.org/t/how-much-of-a-difference-does-avoiding-allocations-make/24585>\
**Category:** Performance\
**Created:** [May 24, 2019, 9:12pm UTC](https://discourse.julialang.org/t/how-much-of-a-difference-does-avoiding-allocations-make/24585 "2019-05-24T21:12:05Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 25, 2019, 6:21am UTC](https://discourse.julialang.org/t/how-much-of-a-difference-does-avoiding-allocations-make/24585/7 "2019-05-25T06:21:25Z")

</div>

> [@jules](#):
>
> “you have to avoid allocations” because that’s usually one of the first things people point out about other’s slow code in this forum

As pointed out above, this is mostly relevant for inner loops.

That said, there is a healthy culture of micro-optimization one-upmanship on this forum, which occasionally [runs amok](https://discourse.julialang.org/t/suggestion-keeping-responses-appropriate-for-the-implicit-category/21345), so it is easy to get the impression that there is a standard “bag of tricks” that is absolutely necessary write fast Julia code.

I prefer to think of these this the opposite way: idomatic Julia code is reasonably fast out of the box, provided some [pitfalls](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-tips-1) are _avoided_. 90% of the time it is not worth optimizing it further. The 10% should be identified by profiling and benchmarking.

---

_[View the full topic](https://discourse.julialang.org/t/how-much-of-a-difference-does-avoiding-allocations-make/24585)._
