From d7e2e8d0d3deb4f61f055cacdb91ac9f29229ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Date: Fri, 5 Oct 2007 22:30:14 +0000 Subject: [PATCH] Performance optimization, only sort when necessary. --- statistics.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/statistics.c b/statistics.c index fc91ec8..bd4eefc 100644 --- a/statistics.c +++ b/statistics.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: statistics.c,v 1.2 2007/10/05 22:23:56 ajhseppa Exp $ + * $Id: statistics.c,v 1.3 2007/10/05 22:30:14 ajhseppa Exp $ */ #include "common.h" @@ -99,10 +99,10 @@ void cIptvDeviceStatistics::UpdateActivePids(u_short pid, long payload) if (mostActivePids[numberOfElements - 1].DataAmount < payload) { mostActivePids[numberOfElements - 1].pid = pid; mostActivePids[numberOfElements - 1].DataAmount = payload; - } - // Re-sort - qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc); + // Re-sort + qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc); + } }