From owner-svn-src-all@FreeBSD.ORG Mon Jul 14 22:47:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E82EBF9A for ; Mon, 14 Jul 2014 22:47:59 +0000 (UTC) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F1DD2C0E for ; Mon, 14 Jul 2014 22:47:59 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/auYssS93lfkVCP4K7Q== X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-2-202-24-103.web.vodafone.de [2.202.24.103]) by smtp.strato.de (RZmta 35.2 DYNA|AUTH) with ESMTPSA id Z06027q6EMlsf4c (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Tue, 15 Jul 2014 00:47:54 +0200 (CEST) Received: by britannica.bec.de (sSMTP sendmail emulation); Tue, 15 Jul 2014 00:47:54 +0200 Date: Tue, 15 Jul 2014 00:47:54 +0200 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r268566 - head/usr.bin/users Message-ID: <20140714224754.GA2756@britannica.bec.de> References: <201407120747.s6C7lpYE020200@svn.freebsd.org> <20140712195452.N3279@besplex.bde.org> <20140714192322.GA23366@britannica.bec.de> <20140714193756.GA19466@neva> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140714193756.GA19466@neva> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jul 2014 22:48:00 -0000 On Mon, Jul 14, 2014 at 08:37:56PM +0100, Alexander Nasonov wrote: > Joerg Sonnenberger wrote: > > On Sat, Jul 12, 2014 at 09:34:28PM +1000, Bruce Evans wrote: > > > Run time: > > > C++ sort() was twice as slow as qsort() for sorting 1 million dummy > > > users in the allocation tests. About 8 seconds instead of 4, except > > > when compiled with -g -O0 it was 15 seconds instead of 4. > > > > I find that claim strange and not reproducable. In my tests, std::sort > > tends to be significant faster than qsort. Attached is a small test > > program that for me is twice as fast for sorting integers... > > Integers are faster indeed but I'm not sure about used-defined > types like basic_string. qsort uses 3-way > comparison while std::sort always uses less_than (a The compiler can optimize when a and b are integers but not when > they're user-defined types with a user-defined comparison function. The trinary vs binary partial order function only matters if you have lots of duplicate values. Joerg