diff stencil.jl @ 78:fbf7398f8154 cell_based_test

Inline and inbounds everything
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 24 Jan 2019 14:38:14 +0100
parents 7fd4e7a1cd38
children b795ec7f9ca0
line wrap: on
line diff
--- a/stencil.jl	Fri Jan 18 13:51:32 2019 +0100
+++ b/stencil.jl	Thu Jan 24 14:38:14 2019 +0100
@@ -25,10 +25,10 @@
     end
 end
 
-function apply(s::Stencil, v::AbstractVector, i::Int)
+@inline function apply(s::Stencil, v::AbstractVector, i::Int)
     w = zero(eltype(v))
     for j ∈ s.range[1]:s.range[2]
-        w += s[j]*v[i+j]
+       @inbounds w += s[j]*v[i+j]
     end
     return w
 end