Well, I've run into the ugly problem of ints and floats and other basic data types not being objects, yet I need to store them as an object and then retrieve them again and there are a few different ways to handle this.
Can you please compile and run the following in both debug and non-debug mode, and post your results.
(Don't look at the code, it's ugly :P)
Thanks much.
Can you please compile and run the following in both debug and non-debug mode, and post your results.
(Don't look at the code, it's ugly :P)
Local numiterations:Int = 100000000 Local Obj:Object Local wrap:intwrapper = New intwrapper Local time:Double = MilliSecs() wrap.intval = 55 obj = "test" Print "~n" For Local iter1:Int = 0 Until numiterations test( obj ) Next Print "Convert from object to int via cast to string then int results." Print "Elapsed time over: " + numiterations + " iterations: " + (MilliSecs()-time) Print "~n" time = MilliSecs() For Local iter3:Int = 0 Until numiterations test3( "5" ) Next Print "Convert from string to int results." Print "Elapsed time over: " + numiterations + " iterations: " + (MilliSecs()-time) Print "~n" time = MilliSecs() For Local iter4:Int = 0 Until numiterations test4( wrap ) Next Print "Get int value from wrapper object results." Print "Elapsed time over: " + numiterations + " iterations: " + (MilliSecs()-time) Print "~n" time = MilliSecs() For Local iter2:Int = 0 Until numiterations test2( iter2 ) Next Print "No conversion whatsoever results." Print "Elapsed time over: " + numiterations + " iterations: " + (MilliSecs()-time) Type intwrapper Field intval:Int EndType Function test:Int( obj:Object ) Return Int(String(obj)) EndFunction Function test2:Int( pInt:Int ) Return pInt EndFunction Function test3:Int( obj:String ) Return Int(obj) EndFunction Function test4:Int( obj:Object ) Return intwrapper(obj).intval EndFunction
Thanks much.