wrote in message news:37c30172-9386-45fb-86d0-a10998fcade8@googlegroups.com... Le jeudi 28 décembre 2017 13:00:46 UTC+1, Dmitry A. Kazakov a écrit : ... >> P.S. Just never copy strings if you have performance concerns (even if >> you have none). Nothing to optimize then. Use string slices, pass string >> + an index to start at, do everything in a single pass, there is no >> reason to waste CPU time, memory and brain cells on "tokenizing". > >True. Except for storing the identifiers in a symbol table... It's probably good advice in general, but as always it depends on the problem in question. If the problem can be solved better by a sequence of transformations rather than something monolithic, then copying is inevitable. For instance, in my spam filter, I have a transformed version of the message that contains just the text (eliminating the markup, line ends, and the like), to be used for phrase matching. Otherwise, the spammer could easily hide bad phrases by including (invisible) markup or line endings. That requires a copy of the string. Randy.