Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Marco van de Voort
On Sunday 12 June 2005 12.43, Tomas Hajny wrote: As far as I know, mov instruction doesn't set zero flag. Zero length is checked earlier in the code, though, so it doesn't matter for that - just the jz instruction seems to be useless there. You are right of course, i am not very familiar

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Jonas Maebe
On 13 jun 2005, at 08:46, Marco van de Voort wrote: There also is jecx, (jeecx ? :-), jecxz but I don't know if it is faster than writing it out. Pretty much all of those old complex instructions (enter, loop, jecxz, xlatb, ...) are slower than the alternatives. Jonas

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Jonas Maebe
On 13 jun 2005, at 09:13, Marco van de Voort wrote: I was thinking about this before I relpied, and knew this was the case for P5-P6 core. However is this verified/documented for generation 7 CPU's ? (Athlon/Netburst ?) Why would they suddenly start spending silicon on making

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Marco van de Voort
On 13 jun 2005, at 08:46, Marco van de Voort wrote: There also is jecx, (jeecx ? :-), jecxz but I don't know if it is faster than writing it out. Pretty much all of those old complex instructions (enter, loop, jecxz, xlatb, ...) are slower than the alternatives. I was thinking

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Marco van de Voort
On 13 jun 2005, at 09:13, Marco van de Voort wrote: I was thinking about this before I relpied, and knew this was the case for P5-P6 core. However is this verified/documented for generation 7 CPU's ? (Athlon/Netburst ?) Why would they suddenly start spending silicon on making

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-13 Thread Florian Klaempfl
Anybody followed the discussion, e.g. which version should be included :)? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Martin Schreiber
Some more experience: 7a: like 7 but ansi string 9a: like 9, without loop instruction 10: like 6, loop in assembler 10a like 10, without loop instruction (PII, 350MHz) Kilix: lowercase execution time: 335536 lowercase 1 execution time: 369539 lowercase 2 execution time: 377384 lowercase 3

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef L505: http://dennishomepage.gugs-cats.dk/LowerCaseChallenge.htm LowerCaseShaPas2_c This one here is in Pascal, using GOTO and LABEL which consistently work fast on both -Og and -OG But no one wants to maintain a GOTO and a LABEL.. [LowerCaseShaPas2_c] was

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Florian Klaempfl
9:29 PM Subject: Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions On Sunday 12 June 2005 00.23, Jonas Maebe wrote: Try also with register variables on (-O???r), it will probably more closely match Kylix' results then in case of the loop versions. Kylix: lowercase

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread L505
I use fastcode stuff some times, I just never spend too much time figuring out how all the code works. The way I do it is I create my software application first in Pascal.. Then if I find a huge bottleneck, I pull in a optimized function in place of the old one.. even if I dont' understand the

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread David Butler
On Sat, 11 Jun 2005 18:36:44 +0200 (CEST), you wrote: The most expensive operation in the whole LowerCase function is the UniqueString allocation for when the string changes. For the case where the string is already in lower case it is important not call UniqueString. It makes a 600%

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Uberto Barbini
That is why I use pchar and one uniquestring; It prevents all these automated uniquestring calls. Why call it when it might not be necessary?? My point is that you can make the function MUCH faster for the case where the function doesn't modify the string by not calling UniqueString at

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Daniël Mantione
Op Sun, 12 Jun 2005, schreef Uberto Barbini: That is why I use pchar and one uniquestring; It prevents all these automated uniquestring calls. Why call it when it might not be necessary?? My point is that you can make the function MUCH faster for the case where the function

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Tomas Hajny
From: Martin Schreiber [EMAIL PROTECTED] To: FPC developers' list fpc- [EMAIL PROTECTED] Subject:Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions Date sent: Sun, 12 Jun 2005 00:12:44 +0200 Some more test results

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Daniël Mantione
Op Sun, 12 Jun 2005, schreef Uberto Barbini: If I understood well, with modern processor an unpredicatable branch (i.e. one with similar probability) is much more time-consuming that an unnecessary function call. Yes, but the call needs to do memory allocation and a string copy, so

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Jonas Maebe
On 12 Jun 2005, at 13:20, Daniël Mantione wrote: Borland's compiler does register variables better than FPC and can do induction variables. This has a large impact on the code generation in general. I thought I saw that FPC beat Kylix in several cases in the timings that were posted.

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Yury Sidorov
Oh, I found the bug. There should be: Inc(byte(P^), 32); instead of previously posted: Inc(byte(P^)); Here is correct implementation: Function Lowercase41(Const S : String) : String; var i: Integer; P: PChar; Changed: boolean; begin Changed:=False; P := PChar(S); for i

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread L505
Borland's compiler does register variables better than FPC and can do induction variables. This has a large impact on the code generation in general. |I thought I saw that FPC beat Kylix in several cases in the timings |that were posted. I saw this too, so what do you mean Daniël .. in the

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Daniël Mantione
Op Sun, 12 Jun 2005, schreef L505: Borland's compiler does register variables better than FPC and can do induction variables. This has a large impact on the code generation in general. |I thought I saw that FPC beat Kylix in several cases in the timings |that were posted. I saw this

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Yury Sidorov
Hello, I was looking at this discussion and decided to put my 5 cents :) I made 2 fastest modifications based on Lowercase4. Lowercase41 is optimized for input which is already lowercased. Lowercase42 slower if input is already lowercased and a bit faster for mixed case input. The best

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-12 Thread Kornel Kisielewicz
Jonas Maebe wrote: Once. Since it is the start value, that is even quite logical. However, even if it appeared in the end condition it would also be only calculated once at the start of the loop. This is even required for correctness, because it's possible to do something like i := 5 for

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef Christian Iversen: On Friday 10 June 2005 17:16, Joost van der Sluis wrote: Hi all, I don't know if rtl-optimilisation patches have a large priority, but nevertheless this patch improves the speed of the sysutils.uppercase and lowercase functions. A

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Fri, 10 Jun 2005, schreef Florian Klaempfl: Joost van der Sluis wrote: Hi all, I don't know if rtl-optimilisation patches have a large priority, It depends if someone does it ;) but nevertheless this patch improves the speed of the sysutils.uppercase and lowercase functions.

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef Michael Van Canneyt: On Sat, 11 Jun 2005, Daniël Mantione wrote: Op Fri, 10 Jun 2005, schreef Florian Klaempfl: Joost van der Sluis wrote: Hi all, I don't know if rtl-optimilisation patches have a large priority, It depends if

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef Daniël Mantione: So, judge for yourself. I think this is worth the 256 byte lookup table. ? 0.948/0.999 = 95 % So, we 5% speed improvement from using a table; this is much worse than I thought and can easily be undone in real world by the increased cache

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Michael Van Canneyt
On Sat, 11 Jun 2005, Joost van der Sluis wrote: If we're gonna hold a discussion like this for every optimilisation, it isn't worth the effort imho. But now we're busy with it: Well. Discussion is nice, but what does the real world show ? To compare, I made 6 versions of Lowercase:

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef Michael Van Canneyt: On Sat, 11 Jun 2005, Joost van der Sluis wrote: If we're gonna hold a discussion like this for every optimilisation, it isn't worth the effort imho. But now we're busy with it: Well. Discussion is nice, but what does the real world

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Michael Van Canneyt
On Sat, 11 Jun 2005, Danil Mantione wrote: Op Sat, 11 Jun 2005, schreef Michael Van Canneyt: On Sat, 11 Jun 2005, Joost van der Sluis wrote: If we're gonna hold a discussion like this for every optimilisation, it isn't worth the effort imho. But now we're busy with it:

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Daniël Mantione
Op Sat, 11 Jun 2005, schreef Michael Van Canneyt: I'm not contesting that; but here I think that the use of pascal is more important, for porting's sake. As long as the Pascal version remains available (for exactly the those portability reasons), I am not against it. Instead, I hope someone

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread David Butler
On Sat, 11 Jun 2005 13:33:57 +0200 (CEST), you wrote: To compare, I made 6 versions of Lowercase: Result on an AMD 64 3000: Lowercase time to execute: 00:00:01.563 Lowercase2 Time to execute: 00:00:01.363 Lowercase3 Time to execute: 00:00:01.394 Lowercase4 Time to execute: 00:00:00.999

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Michael Van Canneyt
On Sat, 11 Jun 2005, Danil Mantione wrote: Op Sat, 11 Jun 2005, schreef Michael Van Canneyt: That is why I use pchar and one uniquestring; It prevents all these automated uniquestring calls. Isn't it a better idea to build a new string, i.e. we setlength result and copy

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread Martin Schreiber
Some more test results with PII 350MHz and two additional implementations with lookup table: Kylix: lowercase execution time: 336887 lowercase 1 execution time: 380923 lowercase 2 execution time: 375411 lowercase 3 execution time: 369814 lowercase 4 execution time: 320665 lowercase 5 execution

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread L505
Where do I find the cpu/cpu-timer unit guys... Directory? Download link? Thank you. | | On 12 Jun 2005, at 00:12, Martin Schreiber wrote: | | Some more test results with PII 350MHz and | two additional implementations with lookup table: | | Try also with register variables on (-O???r), it

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread L505
| Where do I find the cpu/cpu-timer unit guys... | Directory? Download link? | | Thank you. | Is this the one? ;-) http://members.yline.com/~tom_at_work/ | | | | | On 12 Jun 2005, at 00:12, Martin Schreiber wrote: | | | | Some more test results with PII 350MHz and | | two additional

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-11 Thread L505
[EMAIL PROTECTED] To: FPC developers' list fpc-devel@lists.freepascal.org Sent: Saturday, June 11, 2005 9:29 PM Subject: Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions On Sunday 12 June 2005 00.23, Jonas Maebe wrote: Try also with register variables on (-O???r), it will probably more

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-10 Thread Michael Van Canneyt
On Fri, 10 Jun 2005, Joost van der Sluis wrote: Hi all, I don't know if rtl-optimilisation patches have a large priority, but nevertheless this patch improves the speed of the sysutils.uppercase and lowercase functions. I fail to see how changing a while loop to a for loop improves speed

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-10 Thread Luiz Américo
Michael Van Canneyt wrote: On Fri, 10 Jun 2005, Joost van der Sluis wrote: Hi all, I don't know if rtl-optimilisation patches have a large priority, but nevertheless this patch improves the speed of the sysutils.uppercase and lowercase functions. I fail to see how changing a while loop

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-10 Thread Florian Klaempfl
Joost van der Sluis wrote: I don't know if rtl-optimilisation patches have a large priority, but nevertheless this patch improves the speed of the sysutils.uppercase and lowercase functions. I fail to see how changing a while loop to a for loop improves speed ? I could understand if you'd use a

Re: [fpc-devel] Patch to speed up Uppercase/Lowercase functions

2005-06-10 Thread Luiz Américo
Jonas Maebe wrote: [..] Once. Since it is the start value, that is even quite logical. However, even if it appeared in the end condition it would also be only calculated once at the start of the loop. This is even required for correctness, because it's possible to do something like i := 5