The compiled function contains the opcode instructions for the
"virtual machine" while still retaining the full Mathematica
code for use when the arguments are not of the type expected by
Compile (in this
case that the first argument be complex and the second argument
be an integer).

This computes the Mandelbrot function on a
grid of 40000 points using the complied version of the function.
The plot output is suppressed through the
option setting, but we give it the name MandelPlot
so that we can display it later.

Here is the timing comparison for then non-compiled version (on
a Macintosh Powerbook 333 MHz G3).

We see that there is a roughly a factor of 7.4 increase in time
relative to the compiled version.

Here is the graphic:

Packed Arrays

It should also be noted that, because of the new PackedArray
technology in Mathematica 4, there are many automatic speedups
when doing calculations with arrays where the array elements are
of a uniform type.

Packed arrays provide an alternative format for vectors, matrices,
and tensors of machine numbers, (integers, reals and complex
reals). This alternative format coexists with the traditional
format for arrays that has always existed in Mathematica. The
packed and the unpacked formats both behave in equivalent ways,
the system converts from one to the other as necessary.

Some of the benefits of packed arrays are that they use less memory
and that many computations can be faster.

Here we define a
matrix populated with random numbers between 0 and 1.

The Developer`
context contains functions that allow you to see whether or not
an array is a PackedArray.

Many of Mathematica's functions have been optimized to
act very efficiently on arrays that have a uniform type.

Now let's change one element of the array.

Since the first element is now an exact number the array is no
longer a packed array.

As a consequence the execution time is close to a factor of 9
greater.

There is much more that can be said about packed arrays.
This only scratches the surface.