Folks, I have to parse just over a million lines of text as quickly as
possible. I'm using a Regex instance with a simple pattern (no backtrack or
the like) and it's taking from 1 to 2 seconds, which my colleague says is
too slow.

Since it's a .NET 6 library I was keen to use the Span<> overloads of
Regex.Match which should perform much better due to reduced allocations,
but I can't find them. I know there was a big release of Span overloads
recently, but didn't it make it into Regex?

FYI -- My colleague used to parse the lines the old C-style way using a for
(int =0; i<line.Length; i++) and looking for delimiters and *eating* substrings
as he went. That 1970s style code was hard to read, but it performed about
10x faster than a Regex. I thought my demo with a Regex.Match and just a
few lines of code would be faster, but now I have egg on my face. That's
why I was looking for the Span overloads to save my reputation.

*Greg K*

Reply via email to