Re: tweaking MemSet() performance - 7.4.5

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Manfred Spraul <manfred(at)colorfullife(dot)com>, mcolosimo(at)smtp-bedford(dot)mitre(dot)org, Marc Colosimo <mcolosimo(at)mitre(dot)org>, List pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tweaking MemSet() performance - 7.4.5
Date: 2004-09-30 01:47:06
Message-ID: 200409300147.i8U1l6209508@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway wrote:
> On Wed, 2004-09-29 at 21:37, Bruce Momjian wrote:
> > The reason MemSet is a win is not that the C code is great but because
> > it eliminates a function call.
>
> A reasonable compiler ought to be able to implement memset() as a
> compiler intrinsic where it makes sense to do so. MSVC++ can certainly
> do this; per the GCC 3.4 docs, it seems GCC can/does as well:
>
> The ISO C90 functions abort, abs, acos, asin, atan2, atan, calloc, ceil,
> cosh, cos, exit, exp, fabs, floor, fmod, fprintf, fputs, frexp, fscanf,
> labs, ldexp, log10, log, malloc, memcmp, memcpy, memset, modf, pow,
> printf, putchar, puts, scanf, sinh, sin, snprintf, sprintf, sqrt,
> sscanf, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncat,
> strncmp, strncpy, strpbrk, strrchr, strspn, strstr, tanh, tan, vfprintf,
> vprintf and vsprintf are all recognized as built-in functions unless
> -fno-builtin is specified (or -fno-builtin-function is specified for an
> individual function). All of these functions have corresponding versions
> prefixed with __builtin_.
>
> (http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Other-Builtins.html#Other-Builtins)

MemSet was written when gcc 2.X wasn't even stable yet. Have you run
any tests on 3.4 to see if MemSet is still a win with that compiler?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Mallete 2004-09-30 02:12:39 Fwd: error: unicode characters greater than or equal to 0x10000
Previous Message Neil Conway 2004-09-30 00:40:48 Re: tweaking MemSet() performance - 7.4.5