Delphi vs GCC vs MSVC++ Recusrion Follow-up
Hey all,
I ran a few more test using my Fibonacci algorithm. I got a lot
of feedback from the GCC, MSVC++, and Delphi camps. Here are now
the fastest speeds I could attain with each tool (still using
a 486DX2/66 with no cache and 16 megs of RAM):
Delphi 2.0 on Win95 -- 90 seconds
MSVC++ on Win95 (someone sent me an optimized EXE) -- 115 seconds
GCC 2.7.0 on Linux -- 115 seconds
Now, because the C++ compilers improved so much (MSVC++ went from 192s
to 115s, and GCC went from 129s to 115s), I am sure there are more
optimizations out there that I just didn't mess with. On the MSVC++
I just got an "optimized for speed" EXE from a gentleman, and on the GCC,
the best time I got was with the -O2 -fomit-frame-pointer -m486
optimization flags. The stack frame pointers really matter, because
as I mentioned in a follow-up post, turning the "Stack frames" option
on in Delphi 2.0 added some time on my 486DX4/75 ( I didn't retime
it on my 486/66.)
Interesting notes:
- One fellow posted that on his P90, he attained times of 38 seconds for
Delphi 2.0 and 37 seconds for MSVC++ (same algorithm as my original poor one).
- One man ran the algorithm on a SuperSparc20 using a commercial C++
compiler called Centerline in 95 seconds. He could not find any
optimization options. Using GCC with the -O2 option he attained
a time of 90 seconds (and I am sure -fomit-frame-pointer might do
even more.) Nice job, GCC!
- Many people wrote me and posted with better algorithms that still made
good use of recursion. Goes to show compiler optimization and hardware
speed can generally only provide a fraction of the speed increases a
clever algorithm can (most times I got back from these new algorithms
were sub-5-seconds for items as outrageous as fib(10000)).
- It was pointed out to me by a fellow in the C++ newsgroup that
my test was "useless and over-simplified" because it utilized
differing operating systems and tools. Maybe, but that was sort of the
point.
- THANKS TO EVERYONE WHO SENT ME E-MAIL AND ACTUALLY MADE THIS
SOMEWHAT SILLY THREAD WORTHWHILE!
I would have to say that I am beginning to agree with many of the posts
I have seen that state that speed and raw power are not as important anymore
as ease of use and quick development cycles. In this one inane example,
all tools fared relatively similarly. But I can absolutely state
that Delphi is easier to develop such code in, and this was not even a
Windows application. If I had needed to utilize Windows controls,
Delphi's environment would have increased my speed over the other tools
by at least a factor of 2.
Thanks for reading!
Joe Kaufman