[String] Custom iterator for UTF16View (#20929)

Defining a custom iterator for the UTF16View avoid some redundant
computation over the indexing model. This speeds up iteration by
around 40% on non-ASCII strings.
This commit is contained in:
Michael Ilseman
2018-12-01 09:35:27 -08:00
committed by GitHub
parent 1c91dd4933
commit b01ee7267a
4 changed files with 59 additions and 3 deletions

View File

@@ -180,8 +180,8 @@ extension String.UnicodeScalarView {
@inlinable
internal init(_ guts: _StringGuts) {
self._guts = guts
self._end = guts.count
self._guts = guts
}
@inlinable