TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
Fortran vs. C in algorithmic efficiency
Posted by mrnorman [send private reply] at August 29, 2002, 01:31:53 PM Okay, I've looked for answers to this question online, and found conflicting views on (what should be) factual information. I'm curious as to a comparison between the algorithmic efficiencies (array/data structure manipulation, linear computations, etc.) of Fortran and C with respect to runtime and memory. I've seen sites that say C is barely different that Fortran, and some that say Fortran is faster. I'd like to know because I'm thinking about implimenting some modeling algorithms, and it'd be useful to know. So does anyone here know about the relative efficiencies of C and Fortran in different case senarios or whatever (or know of a sight that will tell me)? Thanks.
Posted by Psion [send private reply] at August 29, 2002, 05:12:21 PM Computers that run Fortran and C are not required to have memory. =) You are confusing compilers and languages. Languages don't have intrinsic runtime properties of compiled output.
Posted by RedX [send private reply] at August 29, 2002, 05:42:39 PM There are many comparisons between compilers of the same language. But are there reliable comparisons between compilers of different languages? I mean the best way to do a certain task differs from language to language and how can you test them without the abilities of the programmer(s) being a significant factor in the equation? And add to that that each language has, to some extent, its own specialisation (asm giving complete control of the machine, visual basic allowing fast development, qbasic filling up diskspace and Pascal being easy to learn/teach) makes it quite difficult to put a test together with a result that can be considered a good represetation of the thruth.
(Spelling errors are included to make a point, which one is left as an excercise to the reader)
Posted by regretfuldaydreamer [send private reply] at August 30, 2002, 10:34:14 AM I didn't know there were modern fortran compilers around.
I wouldn't mind learning fortran.
Posted by mrnorman [send private reply] at August 30, 2002, 01:55:59 PM Psion, I'm not quite as proficient in termonology as you, but I think you're basically saying that runtime properties are compiler dependant rather than language dependant. So yeah, I should have phrased the question differently. I guess say, from very similar grade compilers such as gcc and g77 (which are what I use). But, yeah I doubt anyone's done a successful test on the memory requirements (during runtime) and speed of accessing and performing operations on data structures of similar compilers in each language. And yeah daydreamer, Fortran's still very alive in a good number of today's scientific number crunchers (namely the numerical weather forcasting models), but many still haven't upgraded to Fortran 90. I know that C used to be painfully slow compared to Fortran, but I've also read that recently, C and C++ runtimes are catching up with Fortran (or maybe even surpassed it), but this question was meant to verify that from someone here who might have knowledge on the subject, lol. I don't think Fortran's quite as programmer friendly or pretty as C (source-code wise), but it's a relatively good choice if you need to crunch a lot of numbers really fast. I'm not too sure of it's application in non-math/non-science fields, but I think it's a pretty nice language. ;-)
Posted by unknown_lamer [send private reply] at August 30, 2002, 05:24:42 PM g77 and gcc are both part of GCC and use the same backend to generate machine code. They also use the same optimizer (as part of the backend). All g77 and gcc do is (I'm leaving out quite a bit) convert the FORTRAN and C into syntax trees and let the GCC backend do its magic. So I'm going to guess that they will perform with about the same speed, although fortran might be a bit faster because some of its syntaxes are more restricted so they can be more easily optimized.
Posted by RedX [send private reply] at September 01, 2002, 07:42:13 AM http://www.ubka.uni-karlsruhe.de/cgi-bin/psview?document=/ira/2000/5
This is a comparison between C, C++, Java, Perl, Python, Rexx, and Tcl.
Posted by unknown_lamer [send private reply] at September 01, 2002, 03:07:08 PM Even better: http://www.bagley.org/~doug/shootout/
Register as a new user