summaryrefslogtreecommitdiffhomepage
path: root/benchmark/bm_so_mandelbrot.rb
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/bm_so_mandelbrot.rb')
-rw-r--r--benchmark/bm_so_mandelbrot.rb17
1 files changed, 5 insertions, 12 deletions
diff --git a/benchmark/bm_so_mandelbrot.rb b/benchmark/bm_so_mandelbrot.rb
index dd1d75ba1..76331c64b 100644
--- a/benchmark/bm_so_mandelbrot.rb
+++ b/benchmark/bm_so_mandelbrot.rb
@@ -3,7 +3,8 @@
#
# contributed by Karl von Laudermann
# modified by Jeremy Echols
-size = 1000 # ARGV[0].to_i
+
+size = 600 # ARGV[0].to_i
puts "P4\n#{size} #{size}"
@@ -14,9 +15,6 @@ byte_acc = 0
bit_num = 0
count_size = size - 1 # Precomputed size for easy for..in looping
-def id(x)
- x
-end
# For..in loops are faster than .upto, .downto, .times, etc.
for y in 0..count_size
@@ -40,23 +38,18 @@ for y in 0..count_size
end
end
-# byte_acc = (byte_acc << 1) | (escape ? 0b0 : 0b1)
- byte_acc = (byte_acc * 2) | (escape ? 0b0 : 0b1)
-# byte_acc = (byte_acc * 2) + (escape ? 0b0 : 0b1)
-# byte_acc = (byte_acc * 2) + 1
-
+ byte_acc = (byte_acc << 1) | (escape ? 0b0 : 0b1)
bit_num += 1
# Code is very similar for these cases, but using separate blocks
# ensures we skip the shifting when it's unnecessary, which is most cases.
if (bit_num == 8)
-# print byte_acc.chr
+ print byte_acc.chr
byte_acc = 0
bit_num = 0
elsif (x == count_size)
byte_acc <<= (8 - bit_num)
-# byte_acc = byte_acc << (8 - bit_num)
-# print byte_acc.chr
+ print byte_acc.chr
byte_acc = 0
bit_num = 0
end