String compare performance

bearophile bearophileHUGS at lycos.com
Sun Nov 28 04:43:05 PST 2010


Iain Buclaw:

> GDC uses memcmp when using string comparisons in the first implementation.
> 
> if (codon == "TAG" || codon == "TGA" || codon == "TAA")
> 
> And it is still the slowest case of the lot.

The asm of the first version of the function compiled with gdc uses "repz cmpsb". And while I don't remember precise timings for it, I think it was about two times faster than the first version compiled with dmd (on Windows).

Regarding the idea of using memcmp, I have added a comment to the issue 5282.

Bye,
bearophile


More information about the Digitalmars-d mailing list