X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D48732A1FE for ; Thu, 30 Sep 2004 01:41:41 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61739-03 for ; Thu, 30 Sep 2004 00:41:28 +0000 (GMT) Received: from sue.samurai.com (sue.samurai.com [205.207.28.74]) by svr1.postgresql.org (Postfix) with ESMTP id 8EDAD32A1FB for ; Thu, 30 Sep 2004 01:41:24 +0100 (BST) Received: from localhost (localhost [127.0.0.1]) by sue.samurai.com (Postfix) with ESMTP id 65FFB3F32; Wed, 29 Sep 2004 20:41:18 -0400 (EDT) Received: from sue.samurai.com ([127.0.0.1]) by localhost (sue.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 76296-01-2; Wed, 29 Sep 2004 20:41:17 -0400 (EDT) Received: from localhost (unknown [61.88.101.19]) by sue.samurai.com (Postfix) with ESMTP id 9C80C3F11; Wed, 29 Sep 2004 20:41:15 -0400 (EDT) Subject: Re: tweaking MemSet() performance - 7.4.5 From: Neil Conway To: Bruce Momjian Cc: Karel Zak , Manfred Spraul , mcolosimo@smtp-bedford.mitre.org, Marc Colosimo , List pgsql-hackers In-Reply-To: <200409291137.i8TBb0426304@candle.pha.pa.us> References: <200409291137.i8TBb0426304@candle.pha.pa.us> Content-Type: text/plain Message-Id: <1096504848.28946.2598.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 30 Sep 2004 10:40:48 +1000 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/882 X-Sequence-Number: 59448 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