I have a basic function that iterates through an array of x,y coordinates to create a series of PNG images (below). I'm working on optimizing the performance of this script, but upgrading my server from 1 CPU/2GB RAM --> 16 CPUs (same clock speed)/32GB RAM didn't make a difference on the execution time.
I've monitored the memory usage through several processes, and it never seems to utilize more than ~700mb RAM. Is there any way I could modify this script to utilize more resources on my server?
function annotateFrames($text, $x, $y) {
for ($i = 0; $i <= 100; $i++) {
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel('yellow');
$image->newImage(1920, 1080, $pixel);
$draw->setFillColor('blue');
$image->annotateImage($draw, $x[$i], $y[$i], 0, $text);
$image->setImageFormat('png');
$image->setOption('png:bit-depth', '16');
$image->setOption('png:color-type', 6);
$image->writeImage('path/'.$i.'.png');
}
}