escript

A simple one pass "load and go"

Erlang scripting interface

Joe Armstrong
Robert Virding

3 - April - 2001

Last revised 20 - February - 2004 - tested with R11-B3 on Solaris with a bash shell.

Installation

  1. Fetch escript-4.1.tgz
  2. Unpack.
  3. Type make.
  4. Move the file escript to somewhere in your path.

Testing

The fibi script is as follows:

Compiled or Interpreted code?

The default mode of escript is to interpret the code. By adding the attribute:

Will cause the code in the script to be compiled, instead of interpreted. Note that for many scripts interpreting the code is much faster than compiling the code. We can time the code as follows:


$ time fibc 20
fib 20 = 10946

real    0m1.041s
user    0m0.540s
sys     0m0.280s

Here is a table comparing fibi (fibonacci interpreted) with fibc (compiled):
EXpressiontime (secs)
fibi 200.93
fibc 201.041
fibc 301.36
fibi 3038.90

You have to decide for yourself which is faster.

Release Notes

The origonal version was writen by Joe Armstrong and Robert Virding probably on 3 april 2001.

Up to version-3.0 needed a slightly hacked version of erl_eval.erl. These changes are now integrated into the official distribution.

Bugs

Versions