🔗Measure response time with curl

Using the following command:

curl -o /dev/null -s -w %{time_total}  http://www.google.com

In your .zshrc this can be used:

curl_time() {
    curl -o /dev/null -Ls -w " \
   time_namelookup:  %{time_namelookup}\n \
      time_connect:  %{time_connect}\n \
   time_appconnect:  %{time_appconnect}\n \
  time_pretransfer:  %{time_pretransfer}\n \
     time_redirect:  %{time_redirect}\n \
time_starttransfer:  %{time_starttransfer}\n \
                   ----------\n \
        time_total:  %{time_total}\n" "$1"
}

Will output something like:

$ curl_time https://google.com
    time_namelookup:  0.014
       time_connect:  0.024
    time_appconnect:  0.072
   time_pretransfer:  0.072
      time_redirect:  0.000
 time_starttransfer:  0.084
                    ----------
         time_total:  0.084

Get more datapoints:

$ for i in {1..3}; curl -sL -w "%{time_total}\n" -o /dev/null  https://www.google.com