# \[RFC/ANN\] Restacker.jl: A workaround for the heap-allocated-immutable problem?

**URL:** <https://discourse.julialang.org/t/rfc-ann-restacker-jl-a-workaround-for-the-heap-allocated-immutable-problem/35037>\
**Category:** Package Announcements\
**Tags:** package, announcement\
**Created:** [February 23, 2020, 2:29am UTC](https://discourse.julialang.org/t/rfc-ann-restacker-jl-a-workaround-for-the-heap-allocated-immutable-problem/35037 "2020-02-23T02:29:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 23, 2020, 3:42pm UTC](https://discourse.julialang.org/t/rfc-ann-restacker-jl-a-workaround-for-the-heap-allocated-immutable-problem/35037/4 "2020-02-23T15:42:33Z")

</div>

> [@tim.holy](#):
>
> Speaking personally, I don’t think we want Restack.jl as part of our coding lifestyle, because a “do-nothing” package that magically helps performance seems like code-smell. But as a quite surprising discovery prompting an analysis that may improve the compiler ([https://github.com/JuliaLang/julia/issues/34847](https://github.com/JuliaLang/julia/issues/34847)) this is great! Nice detective work by you & Valentin. How on earth did you discover that this helped?

I strongly agree with this statement. I was personally even more surprised by [https://github.com/tkf/Restacker.jl/blob/master/benchmark/bench\_unique.jl](https://github.com/tkf/Restacker.jl/blob/master/benchmark/bench_unique.jl) where the `restack` on the return variable allows us to ellide an allocation in the loop (probably because it is no longer escaping the function).  
Personally I want to see every case where `restack` works analyzed and understood so that the Julia compiler gets better and we don’t need “magic” compiler annotations. I have the same feeling about `@avx` and `@simd` (the latter is useful due to the semantics of reductions). I am happy to attempt to triage these things and at least give an educated guess on examples where this helps.

---

_[View the full topic](https://discourse.julialang.org/t/rfc-ann-restacker-jl-a-workaround-for-the-heap-allocated-immutable-problem/35037)._
