C not the most efficient Programming Language?

My friend sent me this blog post which claims that C is not the most efficient programming language. The basis of the author’s claim is that in most modern computing systems careful hand-crafted optimizations are difficult to do and one has to rely on the prowess of the compiler to produce efficient executables. C, which enables complex pointer arithmetic, makes it very difficult for the compiler to do some optimizations because its free-flowing memory access pattern leads to complications in doing alias analysis. This essentially means that it is difficult to figure out if two pointers can point to the same region in memory in C. If we can figure out that the memory foot prints of two pointers are disjoint, the compiler might be able to step in and do some efficient optimizations, which it is unable to do.

The post makes for interesting reading. The author speaks about an experiment with the implementation of an LCS algorithm on OCaml, C and other languages and claims that OCaml outperformed C.

Food for thought indeed. However, I was not sure if employing good pointer aliasing analysis algorithms in his simple case and performing better optimizations would have enabled C to outperform. His one example may not be representative of all programs and there are too many other variables that have not been studied.


About kpowerinfinity

3 Responses to C not the most efficient Programming Language?

  1. Idetrorce says:

    very interesting, but I don’t agree with you

  2. Shoaib Jameel says:

    Very interesting indeed..it actually depends on the algorithm devised by the programmer that can make one compiler better than the other…
    very difficult though to comapre one algorithm with the other using different languages….
    I believe C is still the most efficient programming langauge.

  3. Nicholas DeWaal says:

    C is the best programming language for graphics applications like gaming. But if you are doing scientific computing, then FORTRAN is the most efficient language available due to the great compilers created for this language. Back in the early days of computing, people that wrote compilers weren’t as lazy about wasting clock cycles like they are today which makes FORTRAN the most efficient language.

    If you don’t believe me, read up on the most commonly used languages on the most powerful supercomputers such as Blue Gene. The languages used are almost always FORTRAN in order to use the computer as efficiently as possible.

%d bloggers like this: