|
LRAUV
revA
|
Under Mission Scripting Requirements, there are several requirments that have pushed us towards adopting an embedded scripting language including:
The requirement Limit the interconnectedness of code to minimize full-system recompiles. also pushes us towards the use of an embedded scripting lanuage.
But which language to use? We defined three measures:
What follows is a short list of the most popular embeddable scripting languages (rankings from list of all programming languages at http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html:
Benchmarks are, of course, a poor measure of the performance of a specific software or hardware platform for a given, unless the task, unless the task is very similar to the benchmark. However, they are probably the only measure we have available. The recent benchmark results here: http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=all shows (from the above list) Lua finishing first, followed by Python, Perl, and PHP in a wide battery of test on a single processor Linux machine (JavaScrpit, Ruby, Tcl are not included in the benchmark). An older benchmark, here: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all has the same results for Lua, Python, Perl, and PHP, with Ruby, Tcl, and JavaScript following behind.
From the above list, the languages most amenable to being embedded in a larger application appear to be JavaScript, Lua, Python, and Tcl.
It is difficult to determine the size of the complied libraries for each of the above languages. However there are references to the compiled size of the Lua library being 230K, while the Jim interpreter for Tcl is only 70KB. Sizes of the Python and JavaScript libraries are not readily available, but are sometimes described as being "large".
Based on the above criteria, Lua appears to be the winner – it is relatively fast (only 9.9x slower than c++), has clear and concise instructions and examples for embedding in a larger application, and our compiled Lua lbrary is only 311KB when compiled for our target platform (273KB when compiled for the host). This is larger than the smallest implementation of Tcl, but small enough for our needs.