[swift-dev] String comparison improvements
Itai Ferber
iferber at apple.com
Wed Jan 17 15:46:44 CST 2018
Hi Lance,
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?
Also, how will this affect bridged strings? If I compare two
`NSString`s, I may get a different result than if I compare the same two
strings as bridged through `String`, correct?
— Itai
On 17 Jan 2018, at 13:19, Lance Parker via swift-dev wrote:
> Hey Swift-Dev,
>
> 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:
>
> 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.
> 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.
>
> 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.
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20180117/56ea0a66/attachment.html>
More information about the swift-dev
mailing list