Hi there,
I'm building a dead link report script, and I'm at the point of optimising it, and I've come across what seems to be a very weird situation. The exact HTTP query being used is:
$method $path HTTP/1.1\r\nHost: $purl[host]\r\nUser-Agent: PHP\r\n\r\n
Where $method is either GET or HEAD and path is the path.
I use the GET method only when a server won't respond to a HEAD request. The script as a whole's been running slowly, so I ran a profiler over it, and the two relevant lines from that output are:
This makes using a GET query about 7 times as fast as a head query (on a per function call basis)... obviously I can change it to use GET all the time, but I would have expected exactly the opposite result - since GET returns much more data than HEAD right?
Any comments, suggestions or wisdom I might apply to this?
I'm building a dead link report script, and I'm at the point of optimising it, and I've come across what seems to be a very weird situation. The exact HTTP query being used is:
$method $path HTTP/1.1\r\nHost: $purl[host]\r\nUser-Agent: PHP\r\n\r\n
Where $method is either GET or HEAD and path is the path.
I use the GET method only when a server won't respond to a HEAD request. The script as a whole's been running slowly, so I ran a profiler over it, and the two relevant lines from that output are:
Code:
f-Calls Time % of Total Timer Name
25 1820.9293 ms ( 0.68 %) get_url_status_code_get
665 255921.7318 ms ( 95.03 %) get_url_status_code_head
This makes using a GET query about 7 times as fast as a head query (on a per function call basis)... obviously I can change it to use GET all the time, but I would have expected exactly the opposite result - since GET returns much more data than HEAD right?
Any comments, suggestions or wisdom I might apply to this?