I thought that using 'final' should speed things up just a bit.
but it actually slows it down a little. Strange....
change the default value of 'Somefield' and see the difference..
but it actually slows it down a little. Strange....
change the default value of 'Somefield' and see the difference..
SuperStrict Global t:tMyType = New tMyType Global t2:tMytype2 = New tMytype2 Global n:Int Global s:Int s = MilliSecs() For n = 1 To 1000000 t.DoStuff() Next s = MilliSecs() - s Print "First test: " + s + "ms" s = MilliSecs() For n = 1 To 1000000 t.DoStuff2() Next s = MilliSecs() - s Print "Second test: " + s + "ms" 'End Print "Final" s = MilliSecs() For n = 1 To 1000000 t2.DoStuff() Next s = MilliSecs() - s Print "First test: " + s + "ms" s = MilliSecs() For n = 1 To 1000000 t2.DoStuff2() Next s = MilliSecs() - s Print "Second test: " + s + "ms" End Type TMyType Field somefield:Int '= 1 Method GetSomeField%() Return somefield End Method Method DoStuff:String() Return (Pi * GetSomeField() + " " + GetSomeField()) End Method Method DoStuff2:String() Return (Pi * somefield + " " + somefield) End Method End Type Type TMyType2 Final Field somefield:Int '= 1 Method GetSomeField%() Final Return somefield End Method Method DoStuff:String() Final Return (Pi * GetSomeField() + " " + GetSomeField()) End Method Method DoStuff2:String() Final Return (Pi * somefield + " " + somefield) End Method End Type