CSC

Fundamentals of a Scripting Language

A scripting language is a high level language which is interpreted by a program, such as a web browser, at runtime, rather than being compiled beforehand. As a result scripting languages such as JavaScript, Python etc are often slower than other languages such as C++ and Java. An example of the speed differences between scripting languages versus compiled can be seen in the table below. To be fair all tests have been completed three times, with a mean average - and run on the same computer - Intel Atom N450 1.66GHz, 1GB RAM, Linux 3.2.0-4-686-pae.

1 2 3 Mean
C 41.131 42.248 43.518 42.299
C++ 43.22 44.54 41.781 43.180
Python 48.297 47.861 48.682 48.280
Ruby 69.342 69.535 69.364 69.414

Graph not displaying properly? No Problem, see the origional here

The test above shows the difference in time taken for each of the programming languages above to count to one million and print to the screen, using the terminal. C and C++ are both compiled beforehand into a native language for the systems processor, and as a result are faster than Python and (very noticeably) Ruby.

Why do we need Scripting Languages?

After looking at the performance shortcomings of scripting languages, you may be left wondering why we need them. Native programs will always be faster as they are already compiled and ready to run, scripting languages need to be interpreted into a language the computer can understand at real time, and this is always slow. The benefits of scripting languages however is that they are completely platform independent. Be it Linux, Android, Windows, iOS etc you can guarantee that the results will be the same. This is especially useful in responsive design as with the awesomeness of HTML5 and CSS3, we have JavaScript which allows for Client Side Customization to get very cool on all devices.


comments powered by Disqus