Обсуждение: Re: [PATCHES] inline newNode()

Поиск
Список
Период
Сортировка

Re: [PATCHES] inline newNode()

От
Gavin Sherry
Дата:
On 10 Oct 2002, Neil Conway wrote:

> Well, I'd assume any C library / compiler of half-decent quality on
> any platform would provide assembly optimized versions of common
> stdlib functions like memset().
>
> While playing around with memset() on my machine (P4 running Linux,
> glibc 2.2.5, GCC 3.2.1pre3), I found the following interesting
> result. I used this simple benchmark (the same one I posted for the
> earlier MemSet() thread on -hackers):
>

[snip]

> Compiled with '-DBUFFER_SIZE=256 -O2', I get the following results in
> seconds:
>
> MemSet(): ~9.6
> memset(): ~19.5
> __builtin_memset(): ~10.00

I ran the same code. I do not understand the results you go. Here are
mine, on an AMD Duron with GCC 3.2 and glibc-2.2.5. Results are:

MemSet(): 14.758 sec
memset(): 11.597 sec
__buildin_memset(): 9.000 sec

Who else wants to test?

Gavin


Re: [PATCHES] inline newNode()

От
Neil Conway
Дата:
Gavin Sherry <swm@linuxworld.com.au> writes:
> On 10 Oct 2002, Neil Conway wrote:
> > Compiled with '-DBUFFER_SIZE=256 -O2', I get the following results in
> > seconds:
> >
> > MemSet(): ~9.6
> > memset(): ~19.5
> > __builtin_memset(): ~10.00
>
> I ran the same code. I do not understand the results you go.

Interesting -- it may be the case that the optimizations performed by
GCC are architecture specific.

I searched for some threads about this on the GCC list. One
interesting result was this:

        http://gcc.gnu.org/ml/gcc/2002-04/msg01114.html

One possible explanation for the different performance you saw is
explained by Jan Hubicka:

        http://gcc.gnu.org/ml/gcc/2002-04/msg01146.html

One thing that confuses me is that GCC decides *not* to use
__builtin_memset() for some reason, even though it appears to be
superior to normal memset() on both of our systems.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC