-
-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve speed of find for random access needles (strings)
For find a string within a string, std.algorithm.searching.find was unnecessarily slow. The reason is it created intermediate slices. A naively written nested-for-loop implementation was a few times faster. For random access ranges (which strings are) this uses an index based algorithm, which does not need to create an intermediate slice. Speed is now comparable to the nested-for-loop implementation even in rather pathological cases. This might help with issue 9646.
- Loading branch information
Showing
1 changed file
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters