but of course running this with the "COUNT/FLOW" option of the V2.3.0 OS Compiler leads to statement counts that are significantly higher due to the fact that the "do #i" loop in now always executed, be it that it's far more efficient than the old "index()", as that only checks on a character-by-character basis.
Does anyone have any smart method, without having to actually print assembler listings and count the actual number of assembler statements executed, to check the efficiency of both approaches. I'm sure doing this lots of times in a loop (I can provide the currently 4,321 actual values of "c" (33 different ones) that are pumped into the routine) and timing it with Strobe would undoubtedly provide a clear winner, but sadly I don't have access to Strobe.
I'm not sure you can use the routine this way without seeing the whole program but it could be more efficient to add the variables to an array and then sort the array (deleting duplicates as you progress). A sink or bubble sort will do fine. Then assign the array variables remaining to your final "cs" string.
Another caution here is that some shops do not initialize all memory to 0 before your program loads so your counters (for example #c) could contain invalid starting values. As a best practices move I would initialize all variables to blank, 0 or a value via the init keyword in the compile.