# QR decomposition in julia 2x slower than octave

**URL:** <https://discourse.julialang.org/t/qr-decomposition-in-julia-2x-slower-than-octave/10043>\
**Category:** Performance\
**Tags:** question\
**Created:** [March 28, 2018, 10:24pm UTC](https://discourse.julialang.org/t/qr-decomposition-in-julia-2x-slower-than-octave/10043 "2018-03-28T22:24:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [March 28, 2018, 10:35pm UTC](https://discourse.julialang.org/t/qr-decomposition-in-julia-2x-slower-than-octave/10043/3 "2018-03-28T22:35:15Z")

</div>

I suspect they may be doing different things. I don’t know what [`qr` method](https://octave.sourceforge.io/octave/function/qr.html) Octave calls when no output arguments are provided, but my guess is that it’s just doing the 1st phase (computing the Householder reflectors and upper-triangular part) and not the 2nd (building Q). This would roughly match [`qrfact`](https://docs.julialang.org/en/stable/stdlib/linalg/#Base.LinAlg.qrfact) in Julia. On my machine, I get:

```julia
julia> @time qrfact(A);
  5.906331 seconds (25.99 k allocations: 194.912 MiB, 2.13% gc time)

julia> @time qr(A);
 16.202900 seconds (93.73 k allocations: 770.718 MiB, 1.62% gc time)

```

---

_[View the full topic](https://discourse.julialang.org/t/qr-decomposition-in-julia-2x-slower-than-octave/10043)._
