my problem is not the string concatenations (its only for reproducing). my problem is the
k=len(s)
function, which is much slower in R6 as with R5.
I read a RichTextField with 2500 lines and step through them. i can use the new NotesRichTextNavigator class in R6 to do it (its fast), but not everybody has a R6 client.
not sure why there is a performance drop between R5.x and R6.x, but from a general point of view, string concatenations (especially the repeated appends in your example code) are always relatively slow, because internally in most BASIC-type languages the strings get temporaily duplicated, memory allocated, freed, etc. The general solution to this for fast string performance is to write a custom function or class which joins the strings together not by concatenation but by array joins (array operations are much faster than string operations).
If you search on google for “Fast string operations”, you’ll find tons of related information.
We tested pushing out a big report using string concatenation versus writing each line. We found that by writing each line at the end of a cycle, we improved performance of the report ten-fold.
… from a general point of view, string concatenations (especially the repeated appends in your example code) are always relatively slow, because internally in most BASIC-type languages the strings get temporaily duplicated, memory allocated, freed, etc. <<<
This is also true in Java, but see this Java best practices post for a workaround: