Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-05

Optimizer in 2.0

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adrian Veith

Hi,

I am newbie with fpc (but not with pascal, which I use more than 20y now). We have lot of existing delphi code, which some of it, I want to port to new platforms - and fpc looks like the right tool for it. But I am concerned about the speed. I did some basic benchmarks and it seems, that the optimizers has no effect in the 2.0 compiler (or the code even get's slower).

With the 1.9.8 compiler, the same code executes 4 times quicker - what happend (or what do I wrong) ?

For optimizing I use the -OG3rp3 switch - is it still valid ?

Thanks,

Adrian.

Reply by email

Florian Klaempfl
to Adrian Veith
Adrian Veith wrote 8 lines
Hi, I am newbie with fpc (but not with pascal, which I use more than 20y now). We have lot of existing delphi code, which some of it, I want to port to new platforms - and fpc looks like the right tool for it. But I am concerned about the speed. I did some basic benchmarks and it seems, that the optimizers has no effect in the 2.0 compiler (or the code even get's slower).

This shouldn't be the case in general, can you give examples or post the benchmark? And don't try with useless code, we don't care about optimziations which test only useless code which never happens in real programs.

Show quoted text 15 lines
With the 1.9.8 compiler, the same code executes 4 times quicker - what happend (or what do I wrong) ? For optimizing I use the -OG3rp3 switch - is it still valid ? Thanks, Adrian. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Adrian Veith
to Florian Klaempfl

It shows with useless code like simple nested for .. to loops, but also with some more useful code like the attached RSA_Angriff from the C'T magazine.

My results are with:

fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr

5266 ms

with:

fpc -Sd -XX RSA_Angriff_D5.dpr

4844 ms

The unoptimized code is faster than the optimized code.

(BTW. I choosed an example where the Delphi compiler is really worse ;-) : 65953 ms)

Same picture with the whet.pas (whether or not the whetstone benchmark is useful) from your source distribution.

With optimization on: 7393.72 MIPS

With optimization off: 8368.20 MIPS

cheers,

Adrian.

Show quoted text 45 lines
Adrian Veith wrote: >Hi, > >I am newbie with fpc (but not with pascal, which I use more than 20y now). >We have lot of existing delphi code, which some of it, I want to port to >new platforms - and fpc looks like the right tool for it. But I am >concerned about the speed. I did some basic benchmarks and it seems, >that the optimizers has no effect in the 2.0 compiler (or the code even >get's slower). > > This shouldn't be the case in general, can you give examples or post the benchmark? And don't try with useless code, we don't care about optimziations which test only useless code which never happens in real programs. >With the 1.9.8 compiler, the same code executes 4 times quicker - what >happend (or what do I wrong) ? > >For optimizing I use the -OG3rp3 switch - is it still valid ? > >Thanks, > >Adrian. > > > >_______________________________________________ >fpc-pascal maillist - >http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Peter Vreman
to Adrian Veith
Show quoted text 17 lines
It shows with useless code like simple nested for .. to loops, but also with some more useful code like the attached RSA_Angriff from the C'T magazine. My results are with: fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr 5266 ms with: fpc -Sd -XX RSA_Angriff_D5.dpr 4844 ms The unoptimized code is faster than the optimized code.

Try without regvars. It is a known issue that register variables don't produce better code on intel cpus because it increase register pressure.

Reply by email

Florian Klaempfl
to Adrian Veith: It shows with useless code like simple nested for .. to loops, but also with some more…
Adrian Veith wrote 17 lines
It shows with useless code like simple nested for .. to loops, but also with some more useful code like the attached RSA_Angriff from the C'T magazine. My results are with: fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr 5266 ms with: fpc -Sd -XX RSA_Angriff_D5.dpr 4844 ms The unoptimized code is faster than the optimized code.

For me the version compiled with -OG3rp3 is the fastest (AthlonXP). Just curious, what CPU do you use?

Reply by email

Adrian Veith
to Florian Klaempfl
Show quoted text 27 lines
Adrian Veith wrote: >It shows with useless code like simple nested for .. to loops, but also >with some more useful code like the attached RSA_Angriff from the C'T >magazine. > >My results are with: > >fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr > >5266 ms > >with: > >fpc -Sd -XX RSA_Angriff_D5.dpr > >4844 ms > >The unoptimized code is faster than the optimized code. > > For me the version compiled with -OG3rp3 is the fastest (AthlonXP). Just curious, what CPU do you use?

Intel Pentium M 730.

I will do the test on a Athlon XP as well. Maybe the picture changes.

Reply by email