Timing HTTP GET with curl

I was looking for a way to time the effect of PHP code changes, and using Firefox Firebug net timing becomes cumbersome quite quickly. The alternative route is to do this simply is via the commandline using one of the net tools.

This is a simple bash alias to retrieve total time to retrieve a web page (without the content nor headers) – place this into your ~/.bashrc file:

timecurl() { curl -s -o /dev/null -w '%{time_total}\n' $1; }

Usage:

timecurl google.com
timecurl http://username:mypassword@testsite.co.uk/page/

e.g.

> timecurl http://google.com
0.188