[pypy-commit] benchmarks default: extend mandelbrot.py
Raemi
noreply at buildbot.pypy.org
Mon May 5 15:27:44 CEST 2014
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch:
Changeset: r258:f7ba852bdc89
Date: 2014-05-05 15:27 +0200
http://bitbucket.org/pypy/benchmarks/changeset/f7ba852bdc89/
Log: extend mandelbrot.py
diff --git a/multithread/mandelbrot/mandelbrot.py b/multithread/mandelbrot/mandelbrot.py
--- a/multithread/mandelbrot/mandelbrot.py
+++ b/multithread/mandelbrot/mandelbrot.py
@@ -52,23 +52,25 @@
return res
-def run(threads=2):
+def run(threads=2, stripes=16):
threads = int(threads)
+ stripes = int(stripes)
+ assert stripes >= threads
ar, ai = -2.0, -1.5
br, bi = 1.0, 1.5
width, height = 4096, 4096
set_thread_pool(ThreadPool(threads))
- step = (bi - ai) / threads
+ step = (bi - ai) / stripes
res = []
ai = -1.5
bi = ai + step
parallel_time = time.time()
- for i in xrange(threads):
+ for i in xrange(stripes):
res.append(Future(calculate,
a=(ar, ai + i * step),
b=(br, bi + i * step),
- im_size=(width, int(height / threads))
+ im_size=(width, int(height / stripes))
))
res = [f() for f in res]
More information about the pypy-commit
mailing list