not sure if such tests yield useful results. Lot's of things may interfere.
Copying from you, i built
Code: Select all
FUNCTION Start() AS VOID
LOCAL nReal1 := 0 AS INT
LOCAL nReal2 := 0 AS INT
LOCAL nI := 0 AS INT
LOCAL nLen := 100000000 AS INT
LOCAL nStart := Seconds() AS REAL8
FOR nI := 1 UPTO nLen
nReal2 := nReal1 + nReal2
NEXT
Console.WriteLine( "Adding numbers with " + NTrim( nLen ) + " iterations took " + NTrim( Seconds() - nStart ) + " seconds" )
RETURN
Result with 1M iterations was 0,02 sec.
With 10M 0,05
with 100M 0,27 (!)
with 1G 2,17
The latter with all Real8 all over the place 2,66
The latter with all decimals all over the place 47,16
I would think about swapping to decimal if number crunching is "on"
Karl