[Issue 9646] std.algorithm.splitter for strings has opportunities for improvement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jun 2 13:40:40 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=9646

--- Comment #2 from github-bugzilla at puremagic.com ---
Commit pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/a9d5b8ca779d2dd89c8b49abae385e793d469e5d
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.

--


More information about the Digitalmars-d-bugs mailing list