Language shift for better performance

I have heard this many times that language X is faster than language Y. Sometimes the comparisions are done between languages of different generations but what worries me the most is when decision of language shift are taken for improving the performance.

Being a Java programmer I have heard the debate of .Net faster than Java and the more old one being C++ faster than Java. All is fine until the language shift decisions are taken just because of performance reasons. It is like you have tried every possible optimization you could think of and the conclusion you get is the current programming language is slow and now you need to re-write in some other languages.

Sometimes people go even further in these comparisions when they start comparing languages of different generations for example people tend to compare Groovy or Ruby with Java wherease both languages are different in their basics where one being a scripting language and other a full blown programming language. What it will be like if I compared Java with assembly? You get the point.

Language decisions should be based on:

How much experience is available in the programming language. Java has the advantage of world’s best brains working on it like Joshua Bloch, Neal Grafter to name a few. Also how much resources are available in the local market.

How fast is it to program in the language. This can be pretty relative measure as experienced programmers can be very very fast in the language they program. But I would like to clarify this with an example. Lets compare Java with PHP, java is a very type safe language where the compiler can warn/notify you of most of the errors whereas PHP being a loosly typed language where you don’t have to decalre the type of variables and not even declare them. I have been programming in Java for almost 7 years now but when I wrote my first project in PHP I was really amazed at how fast I completed the project.

The most important factor about language decision should be the requirements for the task at end. Lets say you want to build a simple reporting application then PHP or .Net would do just good. Similarly for a basic CRUD application scripting languages like Ruby with RoR(Ruby on Rails) would be great. But if you want to build a highly scalable enterprise application that is where you need make good choices. You need to not only consider the factors outlined above but also take a look at the various third party applications/libraries available that can help achieve scalability/availability.

Apart from these factors code mantainability etc. also play a major role in language decisions but in the end you can come up with good frameworks to tackle these problems.

Trust me you can do a lot before you come to the conclusion that the the programming language is the bottle neck. So try hard and you will find solutions, sometimes the solution is under the hand but we fail to realize that.

Before I signoff I would like to make some comments about the people thinking that programming in java is slow. It is not because Java is a very hard language but is because of the amount of choices available for doing a task. Jaava is the only language which has so many web/application frameworks available and for a new comer these many amount of choices creates confusion as to which framework to choose for handling the task. Just compare the java frameworks with .Net, you hardly can name more that three frameworks in .Net. These choices also make life easier for the developers as you dont have to re-invent the wheel every few weeks because most of the time the problem you are facing is faced by someother developer and they have come up with solutions so lets use that. This is true for almost every programming language but is more visible in Java/PHP world because of the amount of developers following the language.

Language shift for better performance

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s