# How to efficiently handle parallelism on a DistributedArray

**URL:** https://discourse.julialang.org/t/how-to-efficiently-handle-parallelism-on-a-distributedarray/81098
**Category:** Performance
**Tags:** performance, parallel, distributed, loops
**Created:** [May 15, 2022, 1:27pm UTC](https://discourse.julialang.org/t/how-to-efficiently-handle-parallelism-on-a-distributedarray/81098 "2022-05-15T13:27:32Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![kfrb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kfrb/32/29557_2.png) [@kfrb](https://discourse.julialang.org/u/kfrb)
#### Post date: [May 23, 2022, 10:47am UTC](https://discourse.julialang.org/t/how-to-efficiently-handle-parallelism-on-a-distributedarray/81098/6 "2022-05-23T10:47:26Z")

</div>

@ultrapoci and @deltaeecs, I had a similar problem and solved it using multithreading. See the old thread for an MWE:

> [@Performance issues with parallel Julia code](https://discourse.julialang.org/t/performance-issues-with-parallel-julia-code/68919/3):
>
> Thank you very much @goerch for your detailed comments and helpful information, which helped me to improve the performance significantly! However, after further research, I decided to also give multithreading a try, as it seems to be better suited for this use case. A slightly better simulation-adapted MWE looks like the following. 
> 
> > **MWE Multithreading**
> >
> > using Base.Threads, LinearAlgebra, Test, BenchmarkTools abstract type AbstractModel end struct Model \<: AbstractModel idx::Vector{Tuple{I…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-efficiently-handle-parallelism-on-a-distributedarray/81098)._
