Fast Evaluation of Interpolation Function

Hi everyone.
I have a code that depends heavily in this massive interpolated function (a distribution of a property in the Earth). It has X,Y,Z and a Property (Slowness of a wave through the medium).

I evaluate the slowness in 16500 at the same time a bunch of times. I cheated the theory by aproximating the solution evaluating only 330 times. But at the end, when I am trying to refine the results, I always have to evaluate many many times…

Any idea how to:

dS=F_Sp.(dr2[:, 1], dr2[:, 2], dr2[:, 3])::Array{Float64,1};

much faster?
Or maybe an alternative to this. Using something different than interpolations?

This is pretty much impossible to tell without seeing your actual code - have you profiled your function to figure out what the bottleneck is?

Two comments on the one line of code you have posted:

  • dr2[:, 1] will create a copy, which is often wasteful and can be circumvented by using @view.
  • The type annotation is almost certain to be irrelevant for performance, so can probably be removed.