<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">Hi Lance,</p>
<p dir="auto">I read Michael’s emails but I don’t remember at the moment — what is the new string comparison implementation going to be based on?<br>
Also, how will this affect bridged strings? If I compare two <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">NSString</code>s, I may get a different result than if I compare the same two strings as bridged through <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">String</code>, correct?</p>
<p dir="auto">— Itai</p>
<p dir="auto">On 17 Jan 2018, at 13:19, Lance Parker via swift-dev wrote:</p>
</div>
<div style="white-space:normal"></div>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div id="214A73A3-DA3F-4542-B204-52078D232B28"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hey Swift-Dev,<div class=""><br class=""></div><div class="">The swift standard library team have been working on a new implementation for comparing Swift strings for Swift 5. Michael touched on the motivations in the State of String email but I’ll summarize here:</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">The Swift String comparison implementations on Apple platforms and Linux differ in results and performance. Apple platforms use CFStringCompare with no locale, while Linux uses ICU libraries. Unifying the algorithms that Swift strings use for comparison is reason alone for doing a new implementation. </li><li class="">We've come up with some great common fast paths that speed up comparisons for a lot of common cases. Our microbenchmarks show up to a 6.8x increase in performance and there is still some low hanging fruit in our implementation that would bring further speedups. </li></ul></div><div class=""><br class=""></div><div class="">Bare in mind this is not intended to be a replacement for sorting strings that will be presented to users, for that developers should stick to NSLocalizedString APIs. </div></div></div></blockquote>
<div style="white-space:normal">
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
</blockquote><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">_______________________________________________<br>
swift-dev mailing list<br>
swift-dev@swift.org<br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" style="color:#777">https://lists.swift.org/mailman/listinfo/swift-dev</a></p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</body>
</html>