Hi,
Not trying to start a language war or anything, but I work in a real-time image processing industry where performance is of utmost concern.
Our initial algorithms were written in Fortran back in the 70's/80's, and eventually translated to C. Right now our application uses C++ for infrastructure-related stuff, and C for the algorithms for maximum performance. The C algorithm functions are parallelized using master-worker design pattern. We use Intel compiler. Our platform is Windows x64.
I have never coded in Fortran but heard that it's great for scientific computing, as well as unmatched (?) performance by other language.
So...here's the question: assuming an algorithm is coded efficiently in C and Fortran (i.e. they both describe the same algorithm), would code produced in Fortran be significantly faster than the C counterpart? Assuming that we use Intel compiler for both C and Fortran.
Because if Fortran really is faster, I'm thinking about making an object code out of Fortran and call it from our C++ infrastructure instead.
Thanks!!
S.
It's hard to tell a priori. Modern C (as distinct from C++) and Fortran are comparably fast and which you use can be a personal choice unless local policy dictates otherwise. I'm surrounded by C colleagues but I prefer that all my bugs be of the Fortran type if only because I can detect and swat them more easily. Fortran is simple to learn and you can quickly recode a C algorithm and see which is faster (for that algorithm only and assuming both codes are equally well written). Did you know that Fortran 2003 is interoperable with C?
Gerry