From 98c6121ee5b7acff3b5477f50b7fcc6e198a4f82 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 10 Sep 2011 20:08:49 +0200 Subject: [PATCH] [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. --- src/task.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/task.c b/src/task.c index 9b21fd9df..a054150d2 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;