# 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:** 12

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 11, 2025, 8:09pm UTC](https://discourse.julialang.org/t/no-more-threadid-indexing-thread-local-storage/131535/12 "2025-08-11T20:09:44Z")

</div>

> [@ufechner7](#):
>
> This is the function we are talking about: [FLORIDyn.jl/src/visualisation/calc\_flowfield.jl at 31081b8e695f5b05f0c3282c365d3eb348f48999 · ufechner7/FLORIDyn.jl · GitHub](https://github.com/ufechner7/FLORIDyn.jl/blob/31081b8e695f5b05f0c3282c365d3eb348f48999/src/visualisation/calc_flowfield.jl#L328C1-L383C1)

In other words, you’d be replacing the line

```julia-auto
GP = buffers.thread_buffers[tid]

```

with something like

```julia-auto
GP = get!(task_local_storage(), :FLORIDyn_buffer) do
   # create new buffer if it doesn't exist yet for this task
end::WindFarm

```

Since this is only executed once per iteration, and the rest of the iteration (the rest of your `for` loop body) seems to do a lot of other work, why would the cost of a dictionary lookup matter?

---

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