# \`@threads\` with \`@simd\` performance regression on \`0.7.0-alpha\`

**URL:** <https://discourse.julialang.org/t/threads-with-simd-performance-regression-on-0-7-0-alpha/11297>\
**Category:** General Usage\
**Tags:** multithreading\
**Created:** [May 31, 2018, 5:28pm UTC](https://discourse.julialang.org/t/threads-with-simd-performance-regression-on-0-7-0-alpha/11297 "2018-05-31T17:28:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![raminammour](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raminammour/32/13572_2.png) [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Post date:** [May 31, 2018, 10:55pm UTC](https://discourse.julialang.org/t/threads-with-simd-performance-regression-on-0-7-0-alpha/11297/2 "2018-05-31T22:55:33Z")

</div>

Ahhh, I think it is issue #15276 again (I don’t understand why `@simd` was triggering it thought)! I thought that was presumably fixed in:

[https://github.com/JuliaLang/julia/pull/24688](https://github.com/JuliaLang/julia/pull/24688)

This fixes it:

```julia
 function fillat!(a)
     Threads.@thread for i2 in 1:size(a,2)
           let i2=i2
              @simd for i1 in 1:size(a,1)
                      @inbounds a[i1,i2]=i1/i2
              end
          end
     end
end
[(n=10^i;a1=rand(n,n);a2=rand(n,n);t1=@elapsed filla!(a1);t2=@elapsed fillat!(a2);(t1,t2/t1,vecnorm(a2-a1))) for i=1:4]
 (7.24e-7, 4.593922651933702, 0.0)     
 (3.2617e-5, 1.0026366618634455, 0.0)  
 (0.003374422, 0.984838885000157, 0.0) 
 (0.336461036, 0.9935467089270926, 0.0)

```

In case this proves useful to anyone 🙂

---

_[View the full topic](https://discourse.julialang.org/t/threads-with-simd-performance-regression-on-0-7-0-alpha/11297)._
