Optimise fetch item selection when fetching many items from same host.

svn path=/trunk/netsurf/; revision=12920
This commit is contained in:
Michael Drake 2011-10-02 12:10:02 +00:00
parent 52513e6c9f
commit 73dbd82b7d

View File

@ -415,6 +415,7 @@ void fetch_dispatch_jobs(void)
*/ */
bool fetch_choose_and_dispatch(void) bool fetch_choose_and_dispatch(void)
{ {
bool same_host;
struct fetch *queueitem; struct fetch *queueitem;
queueitem = queue_ring; queueitem = queue_ring;
do { do {
@ -428,6 +429,15 @@ bool fetch_choose_and_dispatch(void)
/* We can dispatch this item in theory */ /* We can dispatch this item in theory */
return fetch_dispatch_job(queueitem); return fetch_dispatch_job(queueitem);
} }
/* skip over other items with the same host */
same_host = true;
while (same_host == true && queueitem->r_next != queue_ring) {
if (lwc_string_isequal(queueitem->host,
queueitem->r_next->host, &same_host) ==
lwc_error_ok && same_host == true) {
queueitem = queueitem->r_next;
}
}
queueitem = queueitem->r_next; queueitem = queueitem->r_next;
} while (queueitem != queue_ring); } while (queueitem != queue_ring);
return false; return false;