Tuesday, September 18, 2007

Performance vs. Productivity

Programming languages rank differently in terms of performance and productivity. Performance here mainly means the running speed of the application while productivity is related to the consuming of developer time.

Some languages are quite good at performance and bad at productivity. C/C++ is in such category. It is quite difficult to beat C/C++ in terms of performance (I know that in Language Shootout, Ocaml, Haskell and other language can beat C/C++ in some fields). However the development cycle of C/C++ is awful. Write some code, compile it, test it, debug it. The whole development cycle tends to diverge the developer's mind hither and thither, let alone the compilation time of C++ is also quite long.

Other languages are quite good at productivity and bad at performance. Ruby and Python are nice examples of this category. They have nice interpreters to easy the development cycle, yet the generated code is quite slow.

Lisp is somehow different. The productivity is high thanks to REPL. The performance is also not bad. The speed of raw code cannot match that of C/C++. But with careful declarations, the performance of Lisp is not far from C/C++. Note that you only need to optimize the hot spot code.

So which one to choose? It depends on the application type and also on the customer. For system software like OS, C is the preferred choice. The speed of the end product is crucial here. For web applications and scripts where speed is not a key issue, Perl/Python/Ruby are used extensively.

How about numerical simulation? We are desperate for speed. On the other hand, we ourselves are the customers of the simulator we write. Our productivity is mainly related to the time for developing the simulator, not the actual running time. Actually during the long simulation run, we have other issues to do: brainstorming, writing documentation etc. Therefore the language with high productivity while acceptable performance seems to be a good choice. That's probably why MATLAB is so popular in the community. Lisp seems to be good too but rarely heard of.

No comments:

Post a Comment