Now indeed I do use a few (about 5) such calls, mostly for the purpose of
doing case independent string checks such as
if pos('<ITEM>',uppercase(RSS)) = 0 then
(...) RSS here is the single ansistring format of an entire RSS source
Nonetheless - should uppercase take up THAT much CPU time ?
Well, yes, depending on the frequency you do it... You didn't give any
other detail on the code ;-)
Should I rewrite this test ? If so... how would you suggest I do it ?
Certainly ;-)
First option is to upcase the string only once for the whole time you
manipulate it. Even if you modify the string and read the original
string interchangeably I believe keeping the copy and modifying them
both will still be faster.
If you don't need the original string (with correct case) you can even
upcase the string in-place using a PChar variant of the function.
Another option is to use an optimized search algorithm which allow for
case insentitivity. The is boyer-moore matcher in SynEditSearch class,
but there's probably other easier sources ;-)
(BTW, at first I thought the RTL would use the glibc and do localized
csae change, but I just saw that SysUtils.UpperCase only does the
usual ascii-7bit only conversion. So beware if you use your code won't
work if try to find strings with accents...)
-Flávio
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives