# Can we reuse Dictionary allocation?

**URL:** <https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582>\
**Category:** Performance\
**Tags:** question, performance\
**Created:** [August 10, 2022, 12:54pm UTC](https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582 "2022-08-10T12:54:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [August 10, 2022, 1:04pm UTC](https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582/2 "2022-08-10T13:04:36Z")

</div>

I think you could just `empty!` it at the end of each loop iteration. My understanding is that it won’t shrink the internal vectors. In fact, there’s no way to shrink the internal vectors until julia 1.9, when `sizehint!` will be able to shrink them, thanks to [https://github.com/JuliaLang/julia/pull/45004](https://github.com/JuliaLang/julia/pull/45004).

---

_[View the full topic](https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582)._
