From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <rolette@infiniteio.com>
Received: from mail-yk0-f181.google.com (mail-yk0-f181.google.com
 [209.85.160.181]) by dpdk.org (Postfix) with ESMTP id 007CC18F
 for <dev@dpdk.org>; Wed, 10 Dec 2014 18:58:22 +0100 (CET)
Received: by mail-yk0-f181.google.com with SMTP id 142so1441087ykq.26
 for <dev@dpdk.org>; Wed, 10 Dec 2014 09:58:22 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:date
 :message-id:subject:from:to:cc:content-type;
 bh=vthgw23Me5pKf/M2oyC6a7g3/bAjqUimZXkZHn/HtRc=;
 b=jdkuyYHGifR1YL1sxEsp9QUvbWO+a7rYqpq0WRI8zZOB+6UNTyY8abZX/F2QGR/QQ0
 p3wt+slhNTT4u75nOjiFDOGkJJ1ecUvUr7KqJAd515Yw1NKF37OfZt6lRLSN4bIAHkkb
 da/ceUgysf5wrHHJ0tLo9yz5ZX7pdE4e0oLOgP/0qb3HPOaenF2uZ9ytO83Nbd/Xrloa
 wiK/3KHBjUVB9bZUKtoil7yw0++wt7EyZG4wRdcCECpsQGARyvrooALWitoQzrztu0h0
 0CBzOfvk0RnieaetFme7AGyTrkTG6fNuvrfedZGEsU3x4gJsJwUvxy4fVMre6BBHhI8c
 wuqA==
X-Gm-Message-State: ALoCoQm84zogUHL16U/aPH+GnsCIz0GcI0orRB0eyp6sqttichA0GYkesyDQO64RJtMdC2nxy5aq
MIME-Version: 1.0
X-Received: by 10.236.32.40 with SMTP id n28mr4078903yha.16.1418234302460;
 Wed, 10 Dec 2014 09:58:22 -0800 (PST)
Received: by 10.170.54.78 with HTTP; Wed, 10 Dec 2014 09:58:22 -0800 (PST)
In-Reply-To: <2601191342CEEE43887BDE71AB977258213BEA97@IRSMSX105.ger.corp.intel.com>
References: <1418178341-4193-1-git-send-email-michael.qiu@intel.com>
 <20141210104110.GB10056@bricha3-MOBL3>
 <533710CFB86FA344BFBF2D6802E60286C9E768@SHSMSX101.ccr.corp.intel.com>
 <2601191342CEEE43887BDE71AB977258213BEA97@IRSMSX105.ger.corp.intel.com>
Date: Wed, 10 Dec 2014 11:58:22 -0600
Message-ID: <CADNuJVr9airTPGpy9r_PD7ys6GRhmabTS22OmCkQr+UbM5WgoQ@mail.gmail.com>
From: Jay Rolette <rolette@infiniteio.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] Avoid possible memory cpoy when sort
	hugepages
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Dec 2014 17:58:23 -0000

On Wed, Dec 10, 2014 at 5:08 AM, Ananyev, Konstantin <
konstantin.ananyev@intel.com> wrote:

> I wonder why we do need to write our own bubble sort procedure?
> Why we can't use standard qsort() here?
>

Sadly, even bubble sort would be better than the selection sort being used
here. It's guaranteed to be O(n^2) in all cases.

I just got through replacing that entire function in my repo with a call to
qsort() from the standard library last night myself. Faster (although
probably not material to most deployments) and less code.

Jay