Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Aug 2005 16:58:40 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys systm.h src/sys/i386/i386 mp_machdep.c src/sys/amd64/amd64 mp_machdep.c src/sys/geom/stripe g_stripe.c  g_stripe.h
Message-ID:  <20050820162042.W60498@delplex.bde.org>
In-Reply-To: <200508192210.j7JMAJw0076274@repoman.freebsd.org>
References:  <200508192210.j7JMAJw0076274@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 19 Aug 2005, Pawel Jakub Dawidek wrote:

> pjd         2005-08-19 22:10:19 UTC
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/sys              systm.h
>    sys/i386/i386        mp_machdep.c
>    sys/amd64/amd64      mp_machdep.c
>    sys/geom/stripe      g_stripe.c g_stripe.h
>  Log:
>  Avoid code duplication and implement bitcount32() function in systm.h only.
>
>  Reviewed by:    cperciva
>  MFC after:      3 days
>
>  Revision  Changes    Path
>  1.262     +1 -53     src/sys/amd64/amd64/mp_machdep.c
>  1.27      +1 -1      src/sys/geom/stripe/g_stripe.c
>  1.8       +0 -6      src/sys/geom/stripe/g_stripe.h
>  1.253     +1 -53     src/sys/i386/i386/mp_machdep.c
>  1.235     +52 -0     src/sys/sys/systm.h

Kernel library inline functions go in libkern.h.  Kernel library functions
that are too large to be inline go in libkern.  The comment in this one
wonders if it should be in libkern.

I think it is too large to be inline if its efficiency is unimportant and
not as efficient as it should be if its efficiency is important.  I get
the following times for popcount() of the first 10^8 integers (everything
cached) on an AthlonXP 2600 overclocked (-O2 -march=athlon-xp):

inline popcount:          0.68 seconds
static popcount:          1.03
inline popcount1:         0.71
static popcount1:         1.08
inline table[256] lookup: 0.29              with table of u_ints
static table[256] lookup: 0.63
inline table[16] lookup:  0.63
static table[16] lookup:  1.08
inline table[256] lookup: 0.40              with table of u_chars
static table[256] lookup: 0.67

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050820162042.W60498>