pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <neilc@samurai.com>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Karel Zak <zakkr@zf.jcu.cz>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: mcolosimo@smtp-bedford.mitre.org, Marc Colosimo <mcolosimo@mitre.org>
Cc: List pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: tweaking MemSet() performance - 7.4.5
Date: Thu, 30 Sep 2004 10:40:48 +1000
Message-ID: <1096504848.28946.2598.camel@localhost.localdomain> (raw)
In-Reply-To: <200409291137.i8TBb0426304@candle.pha.pa.us>
References: <200409291137.i8TBb0426304@candle.pha.pa.us>

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)

-Neil





view thread (13+ messages)  latest in thread

Message-ID: <1096504848.28946.2598.camel@localhost.localdomain>
Permalink:  ../1096504848.28946.2598.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1096504848.28946.2598.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: neilc@samurai.com, pgman@candle.pha.pa.us, zakkr@zf.jcu.cz, manfred@colorfullife.com, mcolosimo@mitre.org
  Subject: Re: tweaking MemSet() performance - 7.4.5
  In-Reply-To: <1096504848.28946.2598.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox