DelphiFAQ Home Search:

AnsiLowerCase() faster than LowerCase()

 

comments1 comments. Current rating: 3 stars (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:

2007-02-20, 16:20:25
anonymous  
rating
cool fuck Ansi!

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Los Angeles, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.