Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
AnsiLowerCase() faster than LowerCase()
1 comments. Current rating: (1 votes). Leave comments and/ or rate it.
When I tried to speed up SourceCoder, I looked at frequent calls to AnsiLowerCase().
I had made it a habit to use AnsiLowerCase() instead of LowerCase() because I remembered that it would treat non-standard characters properly (e.g. German Umlaute ä => Ä).
The help file shows that it even handles multibyte character sets (MBCS) properly.
The plain LowerCase() does nothing of that and I assumed it might be faster.
This was not the case. The reason is that LowerCase() is implemented in Pascal (in SysUtils.pas), while AnsiLowerCase() calls a Win32 API function using #0 terminated strings.
Indeed, by changing all calls from AnsiLowerCase() to LowerCase(), SourceCoder became about 15% slower (no benchmark was needed, it was very obvious!), so I quickly changed back.
Comments:
|