How come that when I run f(x) within the sheet it is only 37ns, but when I run it from the REPL it is like 1.5ns?
macro horner01(x, p...)
ex = p[end]
for i = length(p)-1:-1:1
ex = :($(p[i]) + $x * $ex)
end
ex
end
function horner02(x, p...)
ex = p[end]
for i = length(p)-1:-1:1
ex = ((p[i]) + x * ex)
end
ex
end
using BenchmarkTools
setprecision(10^8);
x=big(9528)/10000;
x=0.2
res1= @btime @horner01(x,4,3,2,1);
res2= @btime horner02(x,4,3,2,1);
res3= @btime Base.Math.@horner(x,4,3,2,1)
f=x -> Base.Math.@horner(x,4,3,2,1)
res4= @btime f(x)
y=0