Test-Scenario: no other resourcehungry apps running (just notepad and fb2k with playback stopped) ui_columns with all global options disabled and no string in it. Only one column with no sorting and color code. Then, the test-code was inserted into this single column and the speedtest executed three times. The results were then averaged.
$strstr - less expensive than expected:
$puts(123,123456789)
$strstr($get(123),5)
// above line repeated 50x
// test-result averaged over 3 trials: 388
integer-checking: $if+$strcmp VS. $select
$puts(123,1)
$if($strcmp($get(123),1),yes)
// above line repeated 50x
// test-result averaged over 3 trials: 509
$puts(123,1)
$select($get(123),yes)
// above line repeated 50x
// test-result averaged over 3 trials: 306
$puts(123,5)
$select($get(123),yes,maybe,idunno,possibly,ohyeah)
// above line repeated 50x
// test-result averaged over 3 trials: 416
Conclusion: Checking integers is much more cheap with $select when compared to $strcmp - even more if there are more possible options than 1/0. As a bonus, it looks much more clean and is easier to read.
multiple seperate replace-functions VS. single replace-function with multiple parameters
$puts(123,123456789a)
$replace($get(123),1,0)
$replace($get(123),2,0)
$replace($get(123),3,0)
$replace($get(123),4,0)
$replace($get(123),5,0)
$replace($get(123),6,0)
$replace($get(123),7,0)
$replace($get(123),8,0)
$replace($get(123),9,0)
$replace($get(123),a,0)
// above block repeated 5x (totaling 50 replaces)
// test-result averaged over 3 trials: 520
$puts(123,123456789a)
$replace($get(123),1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,a,0)
// above line repeated 5x (totaling 50 replaces)
// test-result averaged over 3 trials: 202
Conclusion: Replace is among the most expensive standard-functions - especially when doing many seperate replaces - but doing many replaces in a single replace-function is cheap.
_______________________
Generally, it seems that tagz-efficiency is less a matter of which functions you use, but more a matter of how many seperate functions you use. The number of parameters you specify to a function makes almost no difference.
So, for fast code try to do as manythings as possible with single functions while trying the keep the overall _amount_ of functions(NOT parameters) low.
I didn't test $transition, because as mentioned in the first post, i already had to learn the hard way that its a resource-killer.
- Lyx