# Performance of norm function

**URL:** <https://discourse.julialang.org/t/performance-of-norm-function/14709>\
**Category:** Performance\
**Tags:** linearalgebra\
**Created:** [September 8, 2018, 7:03pm UTC](https://discourse.julialang.org/t/performance-of-norm-function/14709 "2018-09-08T19:03:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Post date:** [September 8, 2018, 8:52pm UTC](https://discourse.julialang.org/t/performance-of-norm-function/14709/9 "2018-09-08T20:52:22Z")

</div>

Hah, thanks!

So no reason to make a PR, since this affects tiny vectors only, and people caring about speed on tiny vectors presumably use `SVector` already.

That being said, the obvious fast variant still outperforms the BLAS on my system (which presumably is a misconfiguration / build issue).

```julia
julia> A=rand(10_000);
julia> function foo2(A) 
                x = zero(eltype(A))
                @inbounds @simd for v in A
                  @fastmath x += v * v
                end
                @fastmath sqrt(x)
              end
julia> @btime norm($A)
  4.643 μs (0 allocations: 0 bytes)
57.51021904090062

julia> @btime foo2($A)
  1.376 μs (0 allocations: 0 bytes)
57.51021904090062

```

---

_[View the full topic](https://discourse.julialang.org/t/performance-of-norm-function/14709)._
