# No more threadid indexing? \[thread-local storage\]

**URL:** <https://discourse.julialang.org/t/no-more-threadid-indexing-thread-local-storage/131535>\
**Category:** Performance\
**Tags:** multithreading, threads\
**Created:** [August 11, 2025, 7:08pm UTC](https://discourse.julialang.org/t/no-more-threadid-indexing-thread-local-storage/131535 "2025-08-11T19:08:58Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Post date:** [August 12, 2025, 2:30pm UTC](https://discourse.julialang.org/t/no-more-threadid-indexing-thread-local-storage/131535/34 "2025-08-12T14:30:23Z")

</div>

> [@stevengj](#):
>
> It just seems like beefing up `Iterators.partition` as needed would be easier than bike-shedding a whole new API.

I think a different name, instead of keyword arguments would be easier to remember. These are really two different jobs!

> [@stevengj](#):
>
> What’s the advantage of `ChunkSplitters.index_chunks(x; n)` over `Iterators.partition(eachindex(x), cld(length(x), n))`?

It gives a smoother partition. That’s good for threading, and bad for simd / branch prediction. Different job, different tool.

```julia-auto
julia> x=1:100;n=7; length.(collect(Iterators.partition(eachindex(x), cld(length(x), n))))
7-element Vector{Int64}:
 15
 15
 15
 15
 15
 15
 10
julia> length.(collect(ChunkSplitters.index_chunks(x; n)))
7-element Vector{Int64}:
 15
 15
 14
 14
 14
 14
 14

```

---

_[View the full topic](https://discourse.julialang.org/t/no-more-threadid-indexing-thread-local-storage/131535)._
