public void RegexNewlineNormalizerTest() { CodeTimer.WarmUp(); var sb = new StringBuilder(); int length = (1024 * 1024) / sizeof(char); string[] words = { "Dummy", "\r", "\n", "\r\n", " ", "hello", "world", "this", "is", "text", "!", "benchmark", "for", "text" }; var rnd = new Random(0); while (sb.Length < length) { sb.Append(rnd.From(words)); } string oneMbString = sb.ToString(); CodeTimer timer = CodeTimer.Start(); string normalizedString = oneMbString.NormalizeLineEndings(); if (normalizedString.Length > 10) { TestContext.Out.WriteLine("String normalization speed = {0:F2} Mb/s", 1.0 / timer.Time); } }