Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 503 Bytes
# A version w/o complex numbers which created a GC stress
prelude: |
def mandelbrot? x, y
i = 0
while i<100
i += 1
r = x * x - y * y
y = 2.0 * x * y
x = r
return false if Math.sqrt(x * x + y * y) > 2.0
end
true
end
k = 0
benchmark:
mandelbrot: |
ary = []
(0..1000).each{|dx|
(0..1000).each{|dy|
x = dx / 50.0
y = dy / 50.0
ary << [x, y] if mandelbrot?(x,y)
}
}
k += ary.length
loop_count: 100