# Contiguous Read Non-Contiguous Write vs Non-Contiguous Read Contigous Write Performance

**URL:** <https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604>\
**Category:** Performance\
**Created:** [May 1, 2025, 10:22pm UTC](https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604 "2025-05-01T22:22:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 2, 2025, 1:57am UTC](https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604/2 "2025-05-02T01:57:31Z")

</div>

For an out-of-place transpose like this, to get good cache-line utilization you want to do **neither order** : you generally want to “tile” the loops, either by tuning to your cache or by using a cache-oblivious algorithm.

(Optimizing transposition is a heavily studied problem, with a fair amount of literature and code out there if you search.)

See also e.g. [Function on matrix transpose and performance - #4 by stevengj](https://discourse.julialang.org/t/function-on-matrix-transpose-and-performance/20068/4) and the links in that thread.

---

_[View the full topic](https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604)._
