summaryrefslogtreecommitdiff
path: root/bench/mandelbrot.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-10-29 19:08:13 -0700
committerOri Bernstein <ori@eigenstate.org>2017-10-29 19:08:13 -0700
commit269e4f69372bc1250dcb70a9dfde30486809f1b0 (patch)
treeeb86ec1c691bf8f479be36ede67e029f55f3c09c /bench/mandelbrot.myr
parent4eea6de57c9fce0a69f85270303baae069c3e237 (diff)
parentd359a98ab9cfc42de66ad35333bd6d6c0571b7ca (diff)
downloadmc-qbe.tar.gz
Merge branch 'master' into qbeqbe
Diffstat (limited to 'bench/mandelbrot.myr')
-rw-r--r--bench/mandelbrot.myr51
1 files changed, 30 insertions, 21 deletions
diff --git a/bench/mandelbrot.myr b/bench/mandelbrot.myr
index cf75fda..1d3ad01 100644
--- a/bench/mandelbrot.myr
+++ b/bench/mandelbrot.myr
@@ -1,9 +1,39 @@
use std
use bio
+use testr
const Bailout : flt64 = 16.0
const Maxiter = 1000
+const main = {
+ testr.bench([
+ [.name="mandelbrot", .fn=writemandel]
+ ][:])
+}
+
+
+const writemandel = {ctx
+ var x : flt64, y : flt64, i
+ var f
+
+ f = bio.mkfile(1, bio.Wr)
+ for i = 0; i < 10; i++
+ for y = -39.0; y < 39.0; y = y + 1.0
+ for x = -39.0; x < 39.0; x = x + 1.0
+ if mandelbrot(x/40.0, y/40.0) == 0
+ bio.write(f, "*")
+ else
+ bio.write(f, " ")
+ ;;
+ ;;
+ bio.write(f, "\n")
+ ;;
+ ;;
+ bio.write(f, "\n")
+ /* we still use this fd to log our test output... */
+ bio.flush(f)
+}
+
const mandelbrot = {x, y
var cr, ci, zr, zi
var tmp, zr2, zi2
@@ -32,24 +62,3 @@ const mandelbrot = {x, y
;;
-> 0
}
-
-const main = {args : byte[:][:]
- var x : flt64, y : flt64, i
- var f
-
- f = bio.mkfile(1, bio.Wr)
- for i = 0; i < 10; i++
- for y = -39.0; y < 39.0; y = y + 1.0
- for x = -39.0; x < 39.0; x = x + 1.0
- if mandelbrot(x/40.0, y/40.0) == 0
- bio.write(f, "*")
- else
- bio.write(f, " ")
- ;;
- ;;
- bio.write(f, "\n")
- ;;
- ;;
- bio.write(f, "\n")
- bio.close(f)
-}