[String] Inlining, NFC fast paths, and more.

Add inlinability annotations to restore performance parity with 4.2 String.

Take advantage of known NFC as a fast-path for comparison, and
overhaul comparison dispatch.

RRC improvements and optmizations.
This commit is contained in:
Michael Ilseman
2018-10-28 17:03:38 -07:00
parent 9d9f9005e3
commit 8851bac1be
19 changed files with 644 additions and 371 deletions

View File

@@ -213,8 +213,7 @@ extension String.UnicodeScalarView : RangeReplaceableCollection {
///
/// - Parameter c: The character to append to the string.
public mutating func append(_ c: Unicode.Scalar) {
// TODO(UTF8 perf): This is a horribly slow means...
self.append(contentsOf: [c])
self._guts.append(String(c)._guts)
}
/// Appends the Unicode scalar values in the given sequence to the view.