Jan 6, 2008

Love/Hate: Scripting Languages

Scripting languages are languages like Bash, Python, Ruby, Tcl, ... that are interpreted languages that are designed for quick development. Some of them like Ruby and Python are designed for more general purpose things, but are still at heart a scripting language. What is the problem with these? Well, nothing really. I love Ruby, it is a gorgeous language that is easy to use yet still fairly powerful. Combined with Rails it makes an excellent web development platform (unless it is speed you are looking for). Python is good too, however as a computer scientist and a programmer, there are some objections I have to it like lack of encapsulation, enforced indentation - these are more philosophical objections than practical ones though.

So what is the problem with these? The memory footprint. Scripting languages were originally designed to make tasks more automated to take some of the burdens away from the system administrator. They are generally slower and more memory-intensive than the same program would be if written in a compiled language like C++.

Under Windows, there is not much of a problem with this. For the most part, the programs are compiled applications (a lot due to the closed-source nature of the system, but I don't really care). When you come to Linux though, the average Linux system comes with several scripting languages available, with others easily installable. So people developing little apps for Linux like to use scripting languages because they are easier to program with. Now we have tons of little tiny apps that don't really do anything but suck up a ton of memory for each instance of their interpreter running. I have a little app that periodically checks to see if I have new mail in my Gmail inbox that was written in Python, and it uses 10mb of memory! How does that happen? Then you have aMSN, written in Tcl, that uses 40-50mb of memory. I thought Linux programmers were concerned with efficiency! I have 1GB of RAM in this thing which should normally have no problem, but when you combine Firefox, a bittorrent client, anything Java, Ubuntu's caching and all these little tiny background processes written in languages that they never should have been written in, I'm soon running at a crawl because everything is eating up my memory and then moving into the swap space. It just further proves the theory that "as hardware gets better, software gets more inefficient".

No comments: