I think the compiler is optimizing the a=2*2 part (maybe just converting it to a=4?).
I changed the function to the following and its run time is much closer to the non-function method:
I changed the function to the following and its run time is much closer to the non-function method:
Function sq(x#) Return 2*2 End Function t=MilliSecs() Local a# For i=0 To 10000000 a=sq(2) Next Print (MilliSecs()-t)