faster splitter
Patrick Schluter via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 1 06:47:10 PDT 2016
On Wednesday, 1 June 2016 at 12:41:19 UTC, Seb wrote:
> On Wednesday, 1 June 2016 at 12:14:07 UTC, Patrick Schluter
> wrote:
>> On Tuesday, 31 May 2016 at 17:54:34 UTC, qznc wrote:
>>> There is a special version of find for searching a single
>>> char in a string. Using a one-letter needle string is more
>>> like a user mistake than something to optimize for.
>>
>> At compile time you may not know the length of the needle,
>> like in the grep command.
>
> 1) how about a CTFE find?
>
What I wanted to say, is that in real life, the input of the
search routine is very often run-time user provided data. Think
of search box in browsers and apps, command line parameter à la
grep, etc. The "string" search function should not
catastrophically break down on special input, like 1 character
strings, unusual Unicode or when needle==haystack. I only said
this to not lose the focus on what is being tried to be achieved
here.
It's often a danger of micro-optimization and unit test focused
development, that a lot of time and effort are spent on
improvements that are completely irrelevant when checked against
what is really needed in real world (i.e. we're full in bike shed
territory here).
More information about the Digitalmars-d
mailing list