From owner-svn-src-stable-11@freebsd.org Sat Apr 8 00:28:56 2017 Return-Path: Delivered-To: svn-src-stable-11@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 25A53D33950; Sat, 8 Apr 2017 00:28:56 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED94C8D; Sat, 8 Apr 2017 00:28:55 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id B98BA5A9F14; Sat, 8 Apr 2017 00:28:54 +0000 (UTC) Date: Sat, 8 Apr 2017 00:28:54 +0000 From: Brooks Davis To: rgrimes@freebsd.org Cc: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r316613 - in stable/11/lib/libc: gen iconv net regex rpc stdio stdlib Message-ID: <20170408002854.GB43485@spindle.one-eyed-alien.net> References: <201704071608.v37G84Ep031357@repo.freebsd.org> <201704080019.v380JEI1057396@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vGgW1X5XWziG23Ko" Content-Disposition: inline In-Reply-To: <201704080019.v380JEI1057396@pdx.rh.CN85.dnsmgr.net> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2017 00:28:56 -0000 --vGgW1X5XWziG23Ko Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 07, 2017 at 05:19:14PM -0700, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: pfg > > Date: Fri Apr 7 16:08:04 2017 > > New Revision: 316613 > > URL: https://svnweb.freebsd.org/changeset/base/316613 > >=20 > > Log: > > MFC r315162: > > libc: provide some bounds-checking through reallocarray(3). > > =20 > > reallocarray(3) is a non portable extension that originated in OpenBS= D. > > Given that it is already in FreeBSD's libc it is useful for the cases > > where reallocation involves a multiplication. =2E.. > I am not sure, but isnt this a code pessimization as you now push > an extra arg on the stack, and also remove the possiblity of compile > time const calculation of foo * bar? I'd be pretty surprised if that was even possible to measure the several cycles your talking about. Even ignoring TLB misses, the realloc/reallocarray call is going to burn thousands of cycles and blow much of your low level I-CACHE and probably D-CACHE. -- Brooks --vGgW1X5XWziG23Ko Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJY6C7GAAoJEKzQXbSebgfAu3wH/2rT6tkKXhSqmWyotEeyNtrz fg9uurKKfwKH6nMbSThvHlBij5nClcSQvjEubksLfZm9lPpSHN9NDhYl4m+oa2GL Jz2OypWlPqTGiyzS1x2HsXSG1mym9IdMc5XokVHb7p7lA4/Mi+RgEKXT6Yy5c9Gu /KXW7ng3QPgblykjFMbEO9fmwEcj2cbR2abTuGT4UlrfuHPDp4YQgWSdBW1gK/FB 5A/Yte6Cb4I+aWXPCF3xvbJCCZDCh5PhB52zZiT5S065i/Q7mBdhxrXihW0mdDkY Jb1Bj2aBTTNG9EQt+BWVIwM8yYLzMIhKrcifnzBbs1TlD/rMTWNic6dnhYYBVew= =RY07 -----END PGP SIGNATURE----- --vGgW1X5XWziG23Ko--