C function vs Fortran function performance

Steve Nuchia
Total Points:
2,237
Status Points:
1,737
Brown Belt
November 25, 2008 10:12 AM PST
Rate
 
|Best Answer
#3

The main differences are

one compiler may simply be better, or better adapted to your particular situation, than the other.

the fortran library is likely to be better tuned for many mathematical operations -- but you can call it from C if you want.

the fortran language permits the compiler to make certain optimizations that are seldom possible in standard C / C++, mainly due to potential aliasing but also to potential recursion / reentrancy issues.  It is usually possible to provide "hints" to a performance-oriented C / C++ compiler that will allow it to make the same optimizations.

In the end, in my opinion, it is easier to express and understand algorithms that involve more advanced data structures in C / C++ than in the fortran that I learned.  Modern fortran may be better but it still feels very combersome to me.  Since better algorithms beat better code every time, use the language that admits the most natural  and most maintainable expression of the algorithm.



Intel Software Network Forums Statistics

8290 users have contributed to 31236 threads and 99111 posts to date.
In the past 24 hours, we have 7 new thread(s) 20 new posts(s), and 30 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x