diff stencil.jl @ 81:7f72e7e14659 patch_based_test

Add benchmarktest and mark all apply functions with @inline and @inbounds
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 24 Jan 2019 14:58:22 +0100
parents 700a74c41b26
children 38733e84ef1a
line wrap: on
line diff
--- a/stencil.jl	Thu Jan 24 14:33:49 2019 +0100
+++ b/stencil.jl	Thu Jan 24 14:58:22 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] # TBD: Make this without boundschecks?
+        @inbounds w += s[j]*v[i+j] # TBD: Make this without boundschecks?
     end
     return w
 end