The motivation for this change is to increase efficiency in a library I am creating to break string inputs along dictionary words. For example: thebigbrownduck -> the big brown duck.
To do this, you have to go character by character down the Trie and break the string when you reach a null node. Then recursively try with the next part. Using spans instead of substrings can be a big performance gain because there are no additional string allocations. We can just keep slicing the original input and work with ReadOnly<char> spans
Added support for
ReadOnlySpan<char>
.The motivation for this change is to increase efficiency in a library I am creating to break string inputs along dictionary words. For example: thebigbrownduck -> the big brown duck.
To do this, you have to go character by character down the Trie and break the string when you reach a null node. Then recursively try with the next part. Using spans instead of substrings can be a big performance gain because there are no additional string allocations. We can just keep slicing the original input and work with
ReadOnly<char>
spans