# Advanced iteration interface in Julia

**URL:** https://discourse.julialang.org/t/advanced-iteration-interface-in-julia/68618
**Category:** Performance
**Tags:** iterators, inline, box
**Created:** [September 23, 2021, 7:07am UTC](https://discourse.julialang.org/t/advanced-iteration-interface-in-julia/68618 "2021-09-23T07:07:30Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)
#### Post date: [September 23, 2021, 9:21am UTC](https://discourse.julialang.org/t/advanced-iteration-interface-in-julia/68618/5 "2021-09-23T09:21:27Z")

</div>

According to an answer to my earlier performance question:

> [@Cannot achieve type-stability and get rid of allocations](https://discourse.julialang.org/t/cannot-achieve-type-stability-and-get-rid-of-allocations/44548/6):
>
> You can wrap those variables in Ref s that you then mutate instead of rebinding.

, the issue is that `s += 1` assigns a new value to the same variable, and this isn’t treated well by the compiler.

---

_[View the full topic](https://discourse.julialang.org/t/advanced-iteration-interface-in-julia/68618)._
