Avoid needless type conversions in InterpolateFunction
Description
Interpolate function converts its lookup value to string first, just to see if it evaluates to “RASTER”, and if not, parses the string into a double again. However, in its common vector usage, the input will already be a number: this conversion business shows up prominently in profile session outputs.
Best to evaluate as a number first, and consider the “RASTER” case only for static inputs (which are quicker to evaluate).
Interpolate function converts its lookup value to string first, just to see if it evaluates to “RASTER”, and if not, parses the string into a double again. However, in its common vector usage, the input will already be a number: this conversion business shows up prominently in profile session outputs.
Best to evaluate as a number first, and consider the “RASTER” case only for static inputs (which are quicker to evaluate).