On Mon, 12 Jun 2006, Bisma Jayadi wrote:
Actually, C isn't faster. That's a Myth (tm)
Is there any scientific proof of this and written by a really known good c or
pascal programmer? Any URLS? I just can't say it without a real acceptable
proof. Even the language-shoutout website still shows c (gcc) is faster than
fpc. :(
Though I'm a big fan of object pascal but I found myself that c (gcc) IS
faster than fpc. Here's the simple comparison example:
All you do is compare standard IO performance. You don't compare the
compiled code's speed.
By default FPC uses a 256 byte buffer for text IO; The C library uses a
4K buffer. Obviously, C's input/output will be faster by a large factor.
Secondly, you should do at least 10-20 testruns of your program. I did
the test, and the optimized, stripped FPC version runs as fast as the C
version on average.
Third, adding the DOS unit adds the overhead of loading /etc/timezone
stuff, further slowing down your program, because it is additional IO...
So your test should be refined to measure compiled code speed, not IO
speed.
Michael.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives