Vetrivel Vetrivel wrote:

> I have downloaded perl and ruby program in net.I run both the
> programs.But the Ruby program performance very wost than perl.Can any
> one tell me the reasons and
> soultion to make ruby as faster than perl.
> I have attached perl program.
> 
> 
> #!/usr/local/bin/ruby
> 
> BAILOUT = 16
> MAX_ITERATIONS = 1000
> 
> class Mandelbrot
> 
>         def initialize
>                 puts "Rendering"
>                 for y in -39...39 do
>                         puts
>                         for x in -39...39 do
>                                 i = iterate(x/40.0,y/40.0)

Don't indent so deeply.  It makes the code much harder to read.

Don't write a mandelbrot program in an interpreted language.
Write it in a compiled language like OCaml.