Which language is faster?
-
I had an interesting conversation the other day and I thought I'd ask the crowd here for further enlightenment. Essentially I am supposed to take a graduate course in numerical methods starting in a week or two, so I asked about what programming would be needed and was told that I could use any language I want. Then the comment was made that a lot of engineering was still being done in FORTRAN because it was the fastest executing language. Now, I've won bets in the past by taking some fairly "fast" FORTRAN and converting it to Pascal/C/VB, etc. and showing that my algorithms run faster than the original FORTRAN. However, in most cases it was the choice of algorithm that made the difference, not the language. I never actually went back and rewrote the FORTRAN code with an algorithm change to do a real comparison, but I'm sure that it would have been faster, too. So, aside from interpreted languages, is there a real case to be made for FORTRAN being faster than other compiled languages on number crunching? Perhaps the floating point libraries are better optimized? My guess is there is not, but that individual compilers may vary some, even with the same language. I haven't programmed much FORTRAN for the last 30 years, so I'm hoping I don't need to go back and do too much of that. As far as I was concerned, discovering that there were languages other than FORTRAN was an epiphany!
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
I've done a lot of optimisation in the games industry where performance is critial. We use C++. To get the best performance out of any language you need to know the underlying hardware architecture to get the best out of it. I've got improvements with things such as memory alignment, parallelism, converting key areas to machine code, better language usage; like removing construtor functionality, etc you need the language you use to give you control over those points. I'd also like to say there is quite a bit of variance within one language depending on which compiler you use and even within a single compiler based on the optimistational settings you use. Slow languages are any that are interpreted like java, python, basic, scripting languages etc. Garbage collecting languages are bad performancewise, like C#, lisp, java etc as they give irratic, unpredicable performance.