Performance
René Micout
rene.micout at numericable.com
Sun Jun 20 08:19:14 EDT 2010
Thank you very much Jim !
Le 20 juin 2010 à 13:18, Jim Ault a écrit :
> In this case I would use an array
> or custom properties. Much faster by far.
>
> --variable array
> add one to vgCpuFlux[ vpNumFlux ]
>
>
> --custom property ( a trickier technique, but more powerful )
>
> get the vgCpuFlux[ vpNumFlux ] of this stack +1
> set the vgCpuFlux[ vpNumFlux ] of this stack to IT
>
> --or store on each card
> get the vgCpuFlux[ vpNumFlux ] of this CARD +1
> set the vgCpuFlux[ vpNumFlux ] of this CARD to IT
>
> ---------------------------------------------------------
> The array method takes 1 tick to do 10,000 times
> put "4" into vpNumFlux
> put the ticks into startt
> repeat 10000 times
> add one to vgCpuFlux[ vpNumFlux ]
> end repeat
> get the ticks - startt
> get IT & cr & vgCpuFlux[ vpNumFlux ]
> answer IT -- => 1 yep only one tick
>
>
> The custom property method takes 14 ticks to do
> put "4" into vpNumFlux
> put the ticks into startt
> repeat 10000 times
> get the vgCpuFlux[ vpNumFlux ] of this stack + 1
> set the vgCpuFlux[ vpNumFlux ] of this stack to IT
> end repeat
> get the ticks - startt
> get IT & cr & the vgCpuFlux[ vpNumFlux ] of this stack
> answer IT -- => 14 ticks
>
> The 'do' command should not be used for simply adding numbers such as a cross-tabulation technique like you are employing.
> Hope this helps.
>
>
> On Jun 20, 2010, at 3:38 AM, René Micout wrote:
>
>> Thank you Mark,
>> In my project I use lot of "do" command...
>> For you, is that (the number of flux (flows) is 5) :
>>
>> put "add 1 to vgCompteurFlux"& vpNuméroduFlux into vxA ; do vxA
>>
>> faster or slower than :
>>
>> switch vpNuméroduFlux
>> case 1 ; add 1 to vgCompteurFlux1 ; break
>> case 2 ; add 1 to vgCompteurFlux2 ; break
>> case 3 ; add 1 to vgCompteurFlux3 ; break
>> case 4 ; add 1 to vgCompteurFlux4 ; break
>> case 5 ; add 1 to vgCompteurFlux5 ; break..
>> end switch
>>
>> You can answer to me : make a test ;-)... But have you ever had this choice to make ?
>>
>
> Jim Ault
> Las Vegas
>
>
>
> _______________________________________________
> 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