From: Willy Tarreau Date: Sat, 10 Sep 2011 18:08:49 +0000 (+0200) Subject: [OPTIM] task: don't scan the run queue if we know it's empty X-Git-Tag: v1.5-dev8~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98c6121ee5b7acff3b5477f50b7fcc6e198a4f82;p=thirdparty%2Fhaproxy.git [OPTIM] task: don't scan the run queue if we know it's empty It happens quite often in fact, so let's save those precious cycles. --- diff --git a/src/task.c b/src/task.c index 9b21fd9df7..a054150d25 100644 --- a/src/task.c +++ b/src/task.c @@ -196,6 +196,10 @@ void process_runnable_tasks(int *next) run_queue_cur = run_queue; /* keep a copy for reporting */ nb_tasks_cur = nb_tasks; max_processed = run_queue; + + if (!run_queue) + return; + if (max_processed > 200) max_processed = 200;