Subject: Re: OOP

From: [email-masked] (George Seibel)
Date: Thu, 10 Feb 94 00:21:53 -0500

Jerry Perlstein writes:
>Paul Townsend replies:
>> I find this point mildly hilarious ! Just yesterday I came across an Amber
>> example where user in question had to increase an array parameter in order
>> to perform a calculation. Time to edit and recompile was minutes.
>> Increased execution time vs dynamic allocation (C etc ...) was probably a
>> second at most. Fair trade ? I think not.
>> 
>I agree with Dan Severances reply to this. I do Monte Carlo simulations
>than often run 7 days or more on an RS6000.  I have written code for this
>both in C and FORTRAN for this machine and frankly I must tell you that
>C is a poor second when it comes to number crunching speed.  While I prefer
>C as a language, the overwhelming need for fast turnaround time requires
>that I stick to FORTRAN. I don't see this changing anytime soon. I would
>be interested to know if anyone else has done comparisons.

I'm afraid Paul Townsend was right.  At least mostly right.  Dan's
interpretation of Paul's statement was that dynamic allocation slowed
the program significantly, like one second out of ten.  In a program
like Amber, you could do the allocation one time, and that would be that.
Never again would you need to allocate.  How long does one malloc() take?
Some number of miliseconds, not a second on any machine I'm aware of.
If your code is brain damaged, and does a malloc/free pair inside of an
inner loop, then yes, you will slow down.  But that's not the fault of
malloc, it's the fault of the programmer who doesn't design well.

As for the speed of C relative to FORTRAN, my experience on SGI and Sun
machines is that there is not a significant difference when both languages
are used correctly.  I've done the comparison.  Fast loops in C look
an awful lot like fast loops in FORTRAN.  You can write slow code in
either language, too.

George Seibel
[email-masked]