Potentially optimise a tuple creation away

Fri, 27 Dec 2019 21:41:52 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 27 Dec 2019 21:41:52 +0200
changeset 31
62645d05985a
parent 30
0b25d9ef7af9
child 32
41d13bf7d637

Potentially optimise a tuple creation away

src/Translate.jl file | annotate | diff | comparison | revisions
--- a/src/Translate.jl	Fri Dec 27 21:40:33 2019 +0200
+++ b/src/Translate.jl	Fri Dec 27 21:41:52 2019 +0200
@@ -35,7 +35,7 @@
 # Base interpolation routine
 #############################
 
-@inline function interpolate2d_quadrants(v, (x, y))
+@inline function interpolate2d_quadrants(v, x, y)
     (m, n) = size(v)
     clipx = xʹ -> max(1, min(xʹ, m))
     clipy = yʹ -> max(1, min(yʹ, n))
@@ -101,8 +101,7 @@
 
     Threads.@threads for i=1:size(x, 1)
         @inbounds for j=1:size(x, 2)
-            pt = (i - u[1, i, j], j - u[2, i, j])
-            x[i, j] = interpolate2d_quadrants(z, pt)
+            x[i, j] = interpolate2d_quadrants(z, i - u[1, i, j], j - u[2, i, j])
         end
     end
 end
@@ -114,7 +113,7 @@
 
     Threads.@threads for i=1:size(x, 1)
         @inbounds for j=1:size(x, 2)
-            x[i, j] = interpolate2d_quadrants(z, (i - a, j - b))
+            x[i, j] = interpolate2d_quadrants(z, i - a, j - b)
         end
     end
 end
@@ -147,7 +146,7 @@
             b[i, 1:py-1] .= 0
             b[i, qy+1:by] .= 0
             for j=py:qy
-                b[i, j] = interpolate2d_quadrants(im, (i+vxʹ, j+vyʹ))
+                b[i, j] = interpolate2d_quadrants(im, i+vxʹ, j+vyʹ)
             end
         end
     end

mercurial