Re: [fpc-pascal] optimization for strlicomp()

2020-06-01 Thread Benito van der Zander
Hi, I had a custom case-insensitive compare function, and it was very slow. Then I benchmarked it and noticed, case-insensitiveness is rarely needed in practice. Then I changed it to something like:   c1:=str1[counter];   c2:=str2[counter];   if c1 <> c2 then begin

Re: [fpc-pascal] optimization for strlicomp()

2020-06-01 Thread Jonas Maebe
On 01/06/2020 09:22, Michael Van Canneyt wrote: > > > On Sun, 31 May 2020, Alexey Tor. via fpc-pascal wrote: > >> b) >> embed upcase to avoid CALL >>   c1:=simplewideupcase(str1[counter]); >>   c2:=simplewideupcase(str2[counter]); >> -> >>  c1:= str1[counter]; >>  c2:= str2[counter]; >>

Re: [fpc-pascal] optimization for strlicomp()

2020-06-01 Thread Marco van de Voort
Op 2020-06-01 om 09:22 schreef Michael Van Canneyt: I think the correct solution is to use a correct widestring upcase, not the simple one. I think he means to have a simple shortcut for some known <127 codepoints, to cut widestring uppercase for long trivial routines. It's not a bad idea

Re: [fpc-pascal] optimization for strlicomp()

2020-06-01 Thread Michael Van Canneyt
On Sun, 31 May 2020, Alexey Tor. via fpc-pascal wrote: function strlicomp(str1,str2 : pwidechar;l : SizeInt) : SizeInt;   var    counter: sizeint;    c1, c2: char;   begin     counter := 0;     if l=0 then   begin     strlicomp := 0;     exit;   end;     repeat  

[fpc-pascal] optimization for strlicomp()

2020-05-31 Thread Alexey Tor. via fpc-pascal
function strlicomp(str1,str2 : pwidechar;l : SizeInt) : SizeInt;   var    counter: sizeint;    c1, c2: char;   begin     counter := 0;     if l=0 then   begin     strlicomp := 0;     exit;   end;     repeat   c1:=simplewideupcase(str1[counter]);