When does a Stack Actually Die in the IDE???

Mark Smith mark at maseurope.net
Tue Apr 18 12:34:27 EDT 2006


I guess we just don't know how the engine does these things...but  
it's interesting to know that getting the short name from the  
fileName is much quicker than from the long ID.

Best,

Mark

On 18 Apr 2006, at 17:02, David Burgun wrote:

>
> On 18 Apr 2006, at 16:29, Mark Smith wrote:
>
>> I time things like this by putting them in a loop:
>>
>>
>> put the millisecs into stTime
>> repeat 10000 -- for example
>>   put the short name of this stack into myStackName
>> end repeat
>> put the millisecs - stTime
>>
>> on my machine, this takes 11 millsecs.
>>
>> But where the engine seemed slower than string slicing, I was  
>> passing the long id of an object to a function, and in that case,  
>> parsing the ID seemed to be quicker than 'get the short name  
>> of..', by a factor of 3 or 4. Obviously, this would only matter if  
>> you were doing something many thousands of times, but you said you  
>> were concerned about it being slow... :)
>
> Yes, I am! This is called in a loop and I really want to get he  
> maximum speed out of it
>
> I just ran the following code:
>
> constant kRepeatCount=10000
>
> on mouseUp
>   local myStartTime
>   local myEndTime
>   local myStackName
>   local myShortNameTime1
>   local myShortNameTime2
>   local myShortNameTime3
>   local myRepeatTime
>   local myStackLongID
>   local myStackFileName
>
>   --
>   --  Calculate the time for just the repeat loop
>   --
>   put the millisecs into myStartTime
>   repeat kRepeatCount
>   end repeat
>   put the millisecs - myStartTime into myRepeatTime
>
>   --
>   --  Calculate the time for getting the short name of this stack
>   --
>   put the millisecs into myStartTime
>   repeat kRepeatCount
>     put the short name of this stack into myStackName
>   end repeat
>   put the millisecs - myStartTime into myShortNameTime1
>
>
>   put the long id of this stack into myStackLongID
>   put the millisecs into myStartTime
>   repeat kRepeatCount
>     put the short name of myStackLongID into myStackName
>   end repeat
>   put the millisecs - myStartTime into myShortNameTime2
>
>   put the fileName of this stack into myStackFileName
>   put the millisecs into myStartTime
>   repeat kRepeatCount
>     put the short name of stack myStackFileName into myStackName
>   end repeat
>   put the millisecs - myStartTime into myShortNameTime3
>
>   put myRepeatTime && myShortNameTime1 && myShortNameTime2 &&  
> myShortNameTime3
> end mouseUp
>
> The figures I got are as follows:
>
> 1 7 58 12
>
> so it looks like dereferencing the stack long ID is taking a really  
> long time in comparison with getting the stack short name via the  
> "this stack" syntax (which is what I guessed), but I was a bit  
> stunned that doing it via the file name is way quicker than using  
> the long id.
>
> Weird, huh?
> All the Best
> Dave
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list