At , being able to provide real results the fastest is a daily concern. However, running full browsers is an expensive task and finding the best solution is not easy. SERP API Trends seem to favor more and more using Headless Chrome over PhantomJS when an automated is needed. The rumor is that the new headless mode of is both faster and less memory intensive than . Unfortunately, I wasn’t able to find any benchmarks to back up or to rebut this statement. So, let’s just do this! browser Chrome PhantomJS We are going to use Ruby Selenium WebDrivers to run both PhantomJS and Headless Chrome. Results might vary slightly if you are using other drivers, but we expect anyway the vast of majority of the charge being the browser itself not the library wrapper. The benchmark loads 1,000 times the Rails default page and checks for integrity. I’ve run it on my 2017 MacBook (1.4 GHz and 16 GB of Ram) with Ruby 2.3.3p222, Chrome 60.0.3112.113 and PhantomJS 2.1.1. Here are the results: As you can see, Headless Chrome finishes 55% faster while consuming 38% less memory than PhantomJS. Headless seems also more stable in performance when running the benchmark again and seems to be the big winner here. Chrome Here the source code of the main benchmark logic: URL_TO_TEST = "http://localhost:3000"TEXT_TO_VERIFY_PROPER_LOAD = "Yay! You’re on Rails!"BENCHMARK_ITERATIONS = 1000 namespace :benchmark do task :phantomjs doputs "== Starting PhantomJS Driver Quitting PhantomJS Driver =="driver.quitend "driver = Selenium::WebDriver.for :phantomjsputs "Benchmarking (#{BENCHMARK_ITERATIONS} times):"time = Benchmark.measure doBENCHMARK_ITERATIONS.times dodriver.navigate.to URL_TO_TESTunless driver.find_element(tag_name: "body").text.include? TEXT_TO_VERIFY_PROPER_LOADraise "Page Not Properly Loaded"endprint '.'endendputs "\nTime taken: #{time}"puts " task :headless_chrome doputs "== Starting Headless Chrome Driver Quitting Headless Chrome Driver =="driver.quitend "headless_chrome_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: [ "--headless" ]})driver = Selenium::WebDriver.for :chrome, desired_capabilities: headless_chrome_capabilitiesputs "Benchmarking (#{BENCHMARK_ITERATIONS} times):"time = Benchmark.measure doBENCHMARK_ITERATIONS.times dodriver.navigate.to URL_TO_TESTunless driver.find_element(tag_name: "body").text.include? TEXT_TO_VERIFY_PROPER_LOADraise "Page Not Properly Loaded"endprint '.'endendputs "\nTime taken: #{time}"puts " end On GitHub: https://github.com/hartator/benchmark-headless-chrome-vs-phantomjs/blob/master/lib/tasks/benchmark.rake Full GitHub if you want to run or modify the benchmark code yourself: https://github.com/hartator/benchmark-headless-chrome-vs-phantomjs