In the recent blog posting, I talked about the right tool for the job. I have some more examples for this. There are numerous sites on the web, which generate the Mandelbrot set.

At the dawn of Java, I did the demonstration at this site, just to show that Java can do this fast enough. Now, that we have Java JIT compilers, we could do much nicer graphics. Also the code is not optimal.

One of the JavaScript implementations of this fractal with impressive speed is on this site. Select the 400×400 size and keep zooming in by clicks. One should be aware that speed often comes by clever implementations, which do just enough to get the desire visual appearance. A good language and compiler helps, but is often not the essential ingredient.

Again, a matrix language can be used, but it is not the right tool. Without using compiled code, it will be too slow.

I did the image above with Euler and some compiled code. It takes about a second to run and plot. This could be done in the Euler language too, but you are punished with much longer running times. The difference is in order of magnitudes.

See the details at this page. The C code can be compiled in the Euler notebook with the Tiny C compiler. Euler comes with a small C editor.

Each novice programmer learns the shortcomings of recursive functions. The simple recursive version of the Fibonacci numbers computes everything 2^x times. You can study it on this Euler page. The algorithm is good for testing the speed of function calls. It takes 15 seconds in Euler to compute fib(30), and a bit longer in Matlab. But compiled code does the job in 0.05 seconds. Of course, the most elementary recursive code will be much, much faster than this.

Another example in Euler is on this page. It studies the distribution of primes. For a test, it generates the first 100 million primes using the sieve of Eratosthenes in C. Here, the code could have done in Euler too, with only slightly more computing time. But the sieve can be done with bytes, or even bits only. So much larger sets of primes can be generated.