We needed a way to validate the server impact of several different image resizing libraries for our Drupal site. Out of the box, Drupal uses the GD library packaged with PHP. Site administrators can also install the ImageMagick module to use either ImageMagick or GraphicsMagick.
This benchmark attempts to simulate the way that Drupal would process an image with each library.
- Node.js 4.x.x - For primary script runner
- PHP 5.5.x - For individual benchmark scripts
- Imagemagick
- Graphicsmagick
npm install
node runner.js
Running this script on a 2015 Macbook Pro, I observed the following results via the script output and Activity Monitor.
Library | Processing Time | PHP thread ~ Memory usage | Image Processing thread ~ Memory Usage |
PHP GD | 17.54 seconds | 23.9M | N/A |
ImageMagick | 24.19 seconds | 5.1M | 33.5M |
GraphicsMagick | 21.15 seconds | 5.1M | 20.1M |
- Improvements to memory monitoring of secondary processes. Because the individual thread clears very quickly, node can't capture the memory usage as a part of the script as it currently stands. Need to investigate better way to check. Currently, the best way to monitor threads is through OS-level monitor like ps, htop, or Activity Monitor.