From owner-freebsd-current@freebsd.org Mon Apr 18 18:56:31 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A204B130CD for ; Mon, 18 Apr 2016 18:56:31 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D1C51F21 for ; Mon, 18 Apr 2016 18:56:30 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id u3IIuO38051026 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 18 Apr 2016 12:56:24 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id u3IIuOtD051023; Mon, 18 Apr 2016 12:56:24 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Mon, 18 Apr 2016 12:56:24 -0600 (MDT) From: Warren Block To: Hans Petter Selasky cc: FreeBSD Current Subject: Re: qsort() documentation In-Reply-To: <5714C86A.8050204@selasky.org> Message-ID: References: <5714C86A.8050204@selasky.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Mon, 18 Apr 2016 12:56:24 -0600 (MDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2016 18:56:31 -0000 On Mon, 18 Apr 2016, Hans Petter Selasky wrote: > Hi, > > Are there any objections adding the following as part of documenting our > kernel's qsort function? > > Index: sys/libkern/qsort.c > =================================================================== > --- sys/libkern/qsort.c (revision 298202) > +++ sys/libkern/qsort.c (working copy) > @@ -45,6 +45,10 @@ > > /* > * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". > + * > + * NOTE: This implementation of qsort() was designed to not have the "was designed to avoid the" > + * worst case complexity of N**2, as seen with the regular quick sort > + * functions as described by Wikipedia. > */ Why Wikipedia, specifically? There are a lot of places that describe quicksort. How about just Note: This implementation of qsort() is designed to avoid the worst-case complexity of N**2 that is often seen with standard versions.