It is nice to have a little check on speed from time to time. I still use
VBA for easy cooperation with less programming savvy colleguaes.
Julia 1.17s.
VBA (excel alt + f11): 12 s.
This is a bit unfair to neolithic man Joel Spolsky since no optimization
was performed:
Sub benchmark()
nsamples = 1000000
Dim y() As Double
ReDim y(1 To nsamples)
x = y
For i = 1 To nsamples
x(i) = (i - 1) * 5 / (nsamples - 1)
Next
Debug.Print ("\nBrutal-force loops, 100 times:")
sngtime = Timer
For m = 1 To 100
For n = 1 To nsamples
y(n) = Cos(2 * x(n) + 5)
Next
Next
Debug.Print Timer - sngtime
End Sub