# LoopVectorization.jl: adding \`@avx\` makes code slower

**URL:** <https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742>\
**Category:** Performance\
**Tags:** question, tullio, loopvectorization\
**Created:** [August 29, 2020, 1:12pm UTC](https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742 "2020-08-29T13:12:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [August 29, 2020, 2:14pm UTC](https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742/4 "2020-08-29T14:14:16Z")

</div>

OK, I should have just pasted the link I guess!

Having sizes in the type parameters is surely ideal for `@nexprs`. But whether this is faster, you will have to try I suppose. On my comptuer, today:

```julia
julia> @btime rotation!($Crot, $Q, $C, $mid)
  455.543 ns (0 allocations: 0 bytes)

julia> @btime rotation_avx!($Crot, $Q, $C, $mid);
  136.706 ns (0 allocations: 0 bytes)

julia> @btime rotation_nexpr!($Crot, $Q, $C);
  180.331 ns (0 allocations: 0 bytes)

julia> QS = @SMatrix rand(3,3);

julia> @btime rotation!($Crot, $QS, $C, $mid);
  377.343 ns (0 allocations: 0 bytes)

julia> @btime rotation_avx!($Crot, $QS, $C, $mid); # LoopVectorization.check_args(QS) == false
  377.142 ns (0 allocations: 0 bytes)

julia> @btime rotation_nexpr!($Crot, $QS, $C);
  167.569 ns (0 allocations: 0 bytes)

```

---

_[View the full topic](https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742)._
