On 16 Jun 2001, at 15:15, Miklos Cserzo wrote:
The speed of the loops are also different by about 50% depending on the following alternative styles:
[...]
All four of your iteration forms generate identical code with GPC 20010604 (compiled for the x86 processor) when run at the "-O2" optimization level. Try "gpc -S -O2 tester.pas" with the attached source file and examine the resulting "tester.s" file.
My understanding is that GCC (and, by inference, GPC) is intended to be run with the optimizer active, and therefore the output of non-optimized code is expected to be quite poor. I have read that most other compilers, when run "without optimization," are behaving comparably to GCC running at the "-O1" optimization level. Having looked at GCC's assembly output without any optimization, I can believe the assertion, as there are a remarkable number of redundant loads and stores.
So, if you are not already doing so, I would recommend compiling with at least "-O1" and trying your timing tests again.
-- Dave