Kenneth Falck's Blog

PhantomJS render() performance

Posted on 2014-08-18 by Kenneth Falck

I recently tested the render() performance of PhantomJS using different output methods. Calling render() saves a screenshot of the webpage that's currently loaded into PhantomJS and it can be done repeatedly to create a frame-by-frame video while the page is still loading. My motivation was to see if there's any difference depending on whether the images are saved to files, written to stdout or dumped to memory in base64 format.

My conclusion is that there's no practical difference between writing files and writing to stdout. However, writing to memory in base64 format is significantly slower than the other methods.

Here's the measurement data. The same website was loaded three times for each variation on a MacBook Pro using PhantomJS 1.9.7. Images were saved in PNG format, with a 10ms delay after each successful render.


  • Got 58 screenshots in 10525ms at 5.5 FPS
  • Got 92 screenshots in 12916ms at 7.1 FPS
  • Got 49 screenshots in 9673ms at 5 FPS


  • Got 122 screenshots in 10434ms at 11.6 FPS
  • Got 115 screenshots in 10080ms at 11.4 FPS
  • Got 101 screenshots in 9440ms at 10.6 FPS


  • Got 119 screenshots in 10446ms at 11.3 FPS
  • Got 136 screenshots in 10994ms at 12.3 FPS
  • Got 106 screenshots in 10135ms at 10.4 FPS

As you can see, this was not a very scientific test, but it provided me with some rough insight on how to use render() in PhantomJS. It also seems to be impossible to get very high frame rates while pages are loading, because render() and renderBase64() are synchronous operations and will block until each screenshot has been generated and saved.