This is a rather extreme test ... still, was fun ...
[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 0 128
real 0m11.441s
user 0m11.386s
sys 0m0.043s
[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 1 128
real 0m2.951s
user 0m21.308s
sys 0m0.243s
[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 0 256
real 0m19.072s
user 0m19.010s
sys 0m0.044s
[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 1 256
real 0m4.786s
user 0m36.023s
sys 0m0.247s
I used as many threads as I have cores, the only sensible number to use ;)
If you want to render Larger images, you may get into memory allocation trouble because of the huge amount of items in
$range
.Also the statement
$image = $this->img;
will use a lot of memory.I would suggest removing L24-L27 and L31
Replacing L33 with:
And
$image
in L49 and L55 with$this->img
With this changes I've made a 15306x10240px @ 8 Threads with 256 Iterations without problems.