Date: Fri, 13 Jul 2012 00:05:33 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Chris Rees <utisoft@gmail.com> Cc: svn-doc-head@freebsd.org, svn-doc-all@freebsd.org, doc-committers@freebsd.org, Isabell Long <issyl0@freebsd.org> Subject: Re: svn commit: r39189 - head/en_US.ISO8859-1/books/porters-handbook Message-ID: <20120712210533.GL2338@deviant.kiev.zoral.com.ua> In-Reply-To: <CADLo838yNznN57Mwy62aePvznHAVOfo6eLGfnJ_quj8TKr55Ng@mail.gmail.com> References: <201207121412.q6CECngA011553@svn.freebsd.org> <20120712150548.GK2338@deviant.kiev.zoral.com.ua> <CADLo838yNznN57Mwy62aePvznHAVOfo6eLGfnJ_quj8TKr55Ng@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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" <kostikbel@gmail.com> 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. > > > > > + <para>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.</para> > > 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120712210533.GL2338>