[swift-evolution] Fast String Comparison From String Arrays

Michael Ilseman milseman at apple.com
Fri Jul 28 13:11:49 CDT 2017

This sounds like an interesting idea. The best way to promote this would be to make a Swift package first, so that Swift users can use it right away and we can see how it works in practice. If it has sufficient merit and general applicability, then it makes sense to propose including it in the standard library. There are tradeoffs to increasing the API surface area of the standard library, so having experience with a SPM package first can help drive discussion.

> On Jul 28, 2017, at 5:54 AM, Omar Charif via swift-evolution <swift-evolution at swift.org> wrote:
> Hi,
> I wonder whether there is already a way in Swift to compare a string against a large string array quickly without using the traditional ways of comparison. 
> Say we have ["a", "b", "c", "d"] and we would like to find whether this array contains "a", then we decide to check if we have "b" in that same array. Don't you think there is a way to represent the array in a different way and make this comparison a lot quicker ?
> I know there are recurrent neural networks etc ... I am talking here about solution without learning anything, just representing the array differently so we can minimize that O(N).
> I have developed an algorithm and it is doing pretty well so far and I wonder whether it would be accepted so I came to propose and see if this is interesting from your perspective.
> I developed a Javascript version here https://omarshariffathi.github.io/quickhint/ <https://omarshariffathi.github.io/quickhint/>
> If you think this is welcome in Swift Foundation I am ready for a pull request.
> Thanks for reading.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170728/702562d2/attachment.html>

More information about the swift-evolution mailing list