I found an absolutely brutal optimization. 3.500% faster !
A string that used to take 10mn to process is now nailed in 17s !
Let's suppose my string looks like this, where - represents junk data :
----DATA1-------DATA2------------------------DATA3------
There is an awful lot of junk in-between the datas I want to collect, I only have use of 1 caracter out of 14.
So, what I'm doing before processing the string, is filtering out all of the junk code thank to a single regex test:
RegexReplace(TextBox.Text, ".+?(DATA[0-9]).+?", "giu", "| $1 |")
which returns me an amazingly shorter string:
|DATA1||DATA2||DATA3|------
There's still a bit of junk at the end somehow, but so little compared to before I barely even care.