Which option is faster...

jicman cabrera_ at _wrc.xerox.com
Mon Aug 5 08:19:54 PDT 2013


On Monday, 5 August 2013 at 14:50:27 UTC, bearophile wrote:
> jicman:
>
>> How would you make it faster in D1?
>
> Compute std.string.tolower(fext[0]) and put it in a temporary 
> variable. And then compare that variable with all your string 
> literals. In most cases that's fast enough. If it's not enough, 
> you could create a little finite state machine that represents 
> your directed acyclic word graph, and uses gotos to jump around 
> states. The amount of strings is small, so perhaps there are 
> not enough code cache misses to nullify this optimization.
>
> Bye,
> bearophile

Thanks.  This is great.


More information about the Digitalmars-d-learn mailing list