svn commit: r39189 - head/en_US.ISO8859-1/books/porters-handbook

Konstantin Belousov kostikbel at gmail.com
Thu Jul 12 21:05:38 UTC 2012


On Thu, Jul 12, 2012 at 04:32:19PM +0100, Chris Rees wrote:
> On Jul 12, 2012 4:06 PM, "Konstantin Belousov" <kostikbel at gmail.com> wrote:
> >
> > 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.
> 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-doc-all/attachments/20120712/bb1a1718/attachment.pgp


More information about the svn-doc-all mailing list