# Does this lose the benefit of QR decomposition?

**URL:** <https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324>\
**Category:** Performance\
**Tags:** linearalgebra, qr\
**Created:** [March 31, 2021, 7:37pm UTC](https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324 "2021-03-31T19:37:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Ross\_Boylan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ross_boylan/32/9210_2.png) [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Post date:** [April 1, 2021, 11:49pm UTC](https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324/3 "2021-04-01T23:49:29Z")

</div>

Thank you. After overcoming the fact that my code became [so optimized it wouldn’t run at all](https://discourse.julialang.org/t/forwarddiff-and-lapack-dont-get-along/58397), I got it to work. The difference was very large, ~8x faster based on the means, considering that is only one part of the calculations. Memory use shows similar improvements.

# Before

```julia-auto
   julia> @benchmark RBSilly.fit(yx, 2)
    BenchmarkTools.Trial:
      memory estimate: 3.17 MiB
      allocs estimate: 602
      --------------
      minimum time: 71.913 μs (0.00% GC)
      median time: 168.027 μs (0.00% GC)
      mean time: 241.267 μs (41.50% GC)
      maximum time: 2.101 ms (89.42% GC)
      --------------
      samples: 10000
      evals/sample: 1

```

# After

```julia-auto
    julia> @benchmark RBSilly.fit(yx, 2)
    BenchmarkTools.Trial:
      memory estimate: 59.86 KiB
      allocs estimate: 190
      --------------
      minimum time: 23.335 μs (0.00% GC)
      median time: 24.966 μs (0.00% GC)
      mean time: 29.430 μs (11.89% GC)
      maximum time: 3.025 ms (94.90% GC)
      --------------
      samples: 10000
      evals/sample: 1

```

---

_[View the full topic](https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324)._
