From owner-svn-doc-all@FreeBSD.ORG Thu Jul 12 21:05:38 2012 Return-Path: Delivered-To: svn-doc-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89AB5106566B; Thu, 12 Jul 2012 21:05:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 0A9158FC12; Thu, 12 Jul 2012 21:05:37 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q6CL5kHS048515; Fri, 13 Jul 2012 00:05:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q6CL5XSN071667; Fri, 13 Jul 2012 00:05:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q6CL5XC7071666; Fri, 13 Jul 2012 00:05:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Jul 2012 00:05:33 +0300 From: Konstantin Belousov To: Chris Rees Message-ID: <20120712210533.GL2338@deviant.kiev.zoral.com.ua> References: <201207121412.q6CECngA011553@svn.freebsd.org> <20120712150548.GK2338@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1pP7B07eFG5HaxiL" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-doc-head@freebsd.org, svn-doc-all@freebsd.org, doc-committers@freebsd.org, Isabell Long Subject: Re: svn commit: r39189 - head/en_US.ISO8859-1/books/porters-handbook X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2012 21:05:38 -0000 --1pP7B07eFG5HaxiL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 12, 2012 at 04:32:19PM +0100, Chris Rees wrote: > On Jul 12, 2012 4:06 PM, "Konstantin Belousov" wrot= e: > > > > On Thu, Jul 12, 2012 at 02:12:49PM +0000, Isabell Long wrote: > > > Author: issyl0 > > > Date: Thu Jul 12 14:12:49 2012 > > > New Revision: 39189 > > > URL: http://svn.freebsd.org/changeset/doc/39189 > > > > > > Log: > > > Add a section to the Dos and Don'ts section of the porter's handbook > > > about avoiding Linuxisms. > > > > > + A number of simple syscalls (for example > > > + &man.gettimeofday.2;, &man.getpid.2;) are much faster on > > > + &linux; than on any other operating system due to caching and > > > + the vsyscall performance optimizations. Do not rely on them > > > + being cheap in performance-critical applications. In general, > > > + try hard to avoid syscalls if possible. > > And this is not quite true for HEAD and soon for RELENG_9. >=20 > Quite true, so there are others that may be more true. What syscalls > remain that are expensive for us that could be used as examples? The word 'expensive' is relative there. E.g. before the work, gettimeofday call was in range of 200 ns for current hardware, and now on typical modern machine it is ~30 ns. Putting such advises into official documentation, instead of having it in a form of loose notes on wiki, probably includes describing such nuances. I re-read the whole commit, there is similarly not useful paragraph before the one I replied to. IMO, such 'advises' like 'avoid getpid in loops' shall not be done with the straight face, at least not in the official documentation. Better approach is to note that FreeBSD implementation of POSIX and U*X functions is different, so if performance matters, the benchmarks shall be done, bottlenecks identified, and decisions made based on analysis. I might offer much more often cause of different performance, that is different compiler or compiler version used by FreeBSD. --1pP7B07eFG5HaxiL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk//PB0ACgkQC3+MBN1Mb4hyXACcCq/69cg2MXgY9oJ5wthucIr6 1l4An2FB9spPBFmVCbl2OCL+vf0daEIT =eBZp -----END PGP SIGNATURE----- --1pP7B07eFG5HaxiL--