# Strange performance of a loop

**URL:** <https://discourse.julialang.org/t/strange-performance-of-a-loop/12504>\
**Category:** Performance\
**Created:** [July 19, 2018, 4:38pm UTC](https://discourse.julialang.org/t/strange-performance-of-a-loop/12504 "2018-07-19T16:38:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 19, 2018, 5:04pm UTC](https://discourse.julialang.org/t/strange-performance-of-a-loop/12504/2 "2018-07-19T17:04:55Z")

</div>

Isn’t this the exact same discussion as [The cost of size() in for-loops](https://discourse.julialang.org/t/the-cost-of-size-in-for-loops/12491)? If the number of iterations is constant, the loop can be unrolled. If you want the compiler to specialize on specific array sizes, use [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl).

---

_[View the full topic](https://discourse.julialang.org/t/strange-performance-of-a-loop/12504)._
