Silvio a Beccara wrote:
thanks very much for your suggestions. As for the optimisation switches, -march=athlon-xp doesn't seem to work on my system (Mandrake 9.1, gpc version 2.1 (20020510), based on 2.95.3 20010315 (release)). Do I have to compile or install GPC with particular options?
-march option is handled by the backend. Athlon XP and Pentium 4 were released after the release of gcc-2.95, so to use such options you need new backend (like 3.3.5). And if you have Pentium 4 you should use -march=pentium4.
If I use doubles instead of integers, do you think that the performances will again enjoy this enhancement?
Later:
I don't know whether the i686 switch versus the pentium4 switch in the GPC compilation can make a difference of a factor 2, but I am doubtful.
I you look at my numbers you see that I get 3 times speedup by using new version of the compiler. Note that your tests are tiny, on such test you can expect large variation in results.
If you ask about general trends: IIRC 3.3.x backend is on average 10% faster then 2.95.3. Note that average is computed over a family of C programs (SPEC 2000 benchmark). On particular program result can be much different then average. Intel compiler is about 10% faster then GCC when generating code for Pentium 4, when generating code for AMD processors GCC and Intel compiler give equal speed (within mesurement error). Pentium 4 for best performance requires different code then other processors, so 10-20% speedup is typical. Disclaimer: this is opinion based on published benchmarks.
Concerening languages: in principle Pascal can give better code then C (due to more strict typing), but with GPC 'equivalent' Pascal code is likely to run as fast or slightly slower then C code. For matrix computation Fortran should give you faster code then C or Pascal. However assuming that code is well writen and averaging over larger colletion of programs differences should be small, probably less then 10%.
Going to practical recommendations: 10% speedup just by changing compilers may be quite attractive. Similar speedup by changing language is much less attractive. On particular programs you may see much larger difference. Such cases are worth reporting, at least in same cases it is possible to fix GPC to generate faster code.