# Task/thread-local caches/buffers

**URL:** <https://discourse.julialang.org/t/task-thread-local-caches-buffers/101309>\
**Category:** Performance\
**Tags:** question, multithreading, concurrency\
**Created:** [July 7, 2023, 11:50am UTC](https://discourse.julialang.org/t/task-thread-local-caches-buffers/101309 "2023-07-07T11:50:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 7, 2023, 12:06pm UTC](https://discourse.julialang.org/t/task-thread-local-caches-buffers/101309/2 "2023-07-07T12:06:06Z")

</div>

> [@How to correctly design multi-thread cache that's transparent to user iteration?](https://discourse.julialang.org/t/how-to-correctly-design-multi-thread-cache-thats-transparent-to-user-iteration/99577/):
>
> Runnable code and benchmark at [this gist](https://gist.github.com/Moelf/43f181bbfc90cc7b2a2c51f4d98c3050). This is a widespread pattern for columnar-storage access, usually each column is too large to fit in ram, so it’s chunked in to clusters, and each cluster is individually compressed on disk. When user getindex(col, idx), you first need to find the cluster, decompress it, and compute the localidx and return user the data. But user is very likely to also immediately getindex(col, idx+1), so you want to cache the result of decompressed cluster. And the …

maybe can provide some inspiration

---

_[View the full topic](https://discourse.julialang.org/t/task-thread-local-caches-buffers/101309)._
