Strings and text
In C#, all strings are immutable.
Inefficient built-in string APIs
String.StartsWith, default culture 137 String.EndsWith, default culture 542 String.StartsWith, ordinal 115 String.EndsWith, ordinal 34 Custom StartsWith replacement 4.5 Custom EndsWith replacement 4.5
Regular Expressions
While Regular Expressions are a powerful way to match and manipulate strings, they can be extremely performance-intensive. Further, due to the C# library’s implementation of Regular Expressions, even simple boolean IsMatch queries allocate large transient datastructures “under the hood.” This transient managed memory churn should be deemed unacceptable, except during initialization.
XML, JSON and other long-form text parsing
Option 1: Parse at build time
Option 2: Split and lazy load
Option 3: Threads