# \#itertoolspartition

**URL:** https://discourse.julialang.org/tag/itertoolspartition/1392.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Why so many allocations in the loop on partition](https://discourse.julialang.org/t/why-so-many-allocations-in-the-loop-on-partition/101606)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 7\
**Last updated:** [July 14, 2023, 5:39pm UTC](https://discourse.julialang.org/t/why-so-many-allocations-in-the-loop-on-partition/101606 "2023-07-14T17:39:47Z")

</div>

Maybe I do the measurements wrong, but I’m surprised that partition performs so badly in this case. using IterTools, BenchmarkTools a=rand(1:10,10^5) function looppart(a) res=zeros(Int,20) for (a1,a2) in partition(a,2,…

---

## [IterTools.jl Partition type stability?](https://discourse.julialang.org/t/itertools-jl-partition-type-stability/13847)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 3\
**Last updated:** [August 22, 2018, 5:39pm UTC](https://discourse.julialang.org/t/itertools-jl-partition-type-stability/13847 "2018-08-22T17:39:28Z")

</div>

Trying some code like: function test\_loop(event\_times) out = 0.0 for (i, event\_time) in partition(event\_times, 2, 1) out += i + event\_time end return out end @code\_warntype test\_loop(\[1.1, 1.8, …
