Performance

Peter Brigham MD pmbrig at gmail.com
Mon Jun 21 09:21:46 EDT 2010


A more efficient way of doing this would be to group the buttons and  
set the backcolor of each button to empty, then just
    set the backcolor of group "myBtnGroup" to 89,149,218
and all the objects in the group will inherit the backcolor of the  
group (as long as they don't have an individual backcolor set). Note  
that for this to have visible effect for buttons, they must be opaque

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


On Jun 20, 2010, at 9:07 AM, René Micout wrote:

> I have also this case : no variable but object (button) name :
>
>   repeat with i = 1 to 21
>      put "set the backColor of btn" && quote & "btnHarmo"& i & quote  
> && "to" into vxA ; do vxA
>   end repeat
>
> is array solution possible ?
>
> or it is necessary to do :
>
> set the backColor of btn "btnHarmo1" to 89,149,218
> set the backColor of btn "btnHarmo2" to 89,149,218
> set the backColor of btn "btnHarmo3" to 89,149,218
> ...
> ...
> set the backColor of btn "btnHarmo21" to 89,149,218
>
>
> 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
>
> _______________________________________________
> 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