Index: configure
===================================================================
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.473
diff -c -c -r1.473 configure
*** configure	17 Jan 2006 23:52:27 -0000	1.473
--- configure	3 Feb 2006 13:48:02 -0000
***************
*** 21516,21521 ****
--- 21516,21532 ----
  SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
  
  
+ # If not set in template file, set bytes to use libc memset()
+ if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
+   MEMSET_LOOP_LIMIT=1024
+ fi
+ 
+ cat >>confdefs.h <<_ACEOF
+ #define MEMSET_LOOP_LIMIT ${MEMSET_LOOP_LIMIT}
+ _ACEOF
+ 
+ 
+ 
  if test "$enable_nls" = yes ; then
  
    echo "$as_me:$LINENO: checking for library containing gettext" >&5
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.443
diff -c -c -r1.443 configure.in
*** configure.in	17 Jan 2006 23:52:30 -0000	1.443
--- configure.in	3 Feb 2006 13:48:06 -0000
***************
*** 1249,1254 ****
--- 1249,1261 ----
  SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
  
  
+ # If not set in template file, set bytes to use libc memset()
+ if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
+   MEMSET_LOOP_LIMIT=1024
+ fi
+ AC_DEFINE_UNQUOTED(MEMSET_LOOP_LIMIT, ${MEMSET_LOOP_LIMIT}, [Define bytes to use libc memset().])
+ 
+ 
  if test "$enable_nls" = yes ; then
    PGAC_CHECK_GETTEXT
  fi
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.194
diff -c -c -r1.194 c.h
*** src/include/c.h	5 Jan 2006 03:01:37 -0000	1.194
--- src/include/c.h	3 Feb 2006 13:48:09 -0000
***************
*** 614,622 ****
   *	overhead.	However, we have also found that the loop is faster than
   *	native libc memset() on some platforms, even those with assembler
   *	memset() functions.  More research needs to be done, perhaps with
!  *	platform-specific MEMSET_LOOP_LIMIT values or tests in configure.
!  *
!  *	bjm 2002-10-08
   */
  #define MemSet(start, val, len) \
  	do \
--- 614,620 ----
   *	overhead.	However, we have also found that the loop is faster than
   *	native libc memset() on some platforms, even those with assembler
   *	memset() functions.  More research needs to be done, perhaps with
!  *	MEMSET_LOOP_LIMIT tests in configure.
   */
  #define MemSet(start, val, len) \
  	do \
***************
*** 629,635 ****
  		if ((((long) _vstart) & INT_ALIGN_MASK) == 0 && \
  			(_len & INT_ALIGN_MASK) == 0 && \
  			_val == 0 && \
! 			_len <= MEMSET_LOOP_LIMIT) \
  		{ \
  			int32 *_start = (int32 *) _vstart; \
  			int32 *_stop = (int32 *) ((char *) _start + _len); \
--- 627,638 ----
  		if ((((long) _vstart) & INT_ALIGN_MASK) == 0 && \
  			(_len & INT_ALIGN_MASK) == 0 && \
  			_val == 0 && \
! 			_len <= MEMSET_LOOP_LIMIT && \
! 			/* \
! 			 *	If MEMSET_LOOP_LIMIT == 0, optimizer should find \
! 			 *	the whole "if" false at compile time. \
! 			 */ \
! 			MEMSET_LOOP_LIMIT != 0) \
  		{ \
  			int32 *_start = (int32 *) _vstart; \
  			int32 *_stop = (int32 *) ((char *) _start + _len); \
***************
*** 640,647 ****
  			memset(_vstart, _val, _len); \
  	} while (0)
  
- #define MEMSET_LOOP_LIMIT  1024
- 
  /*
   * MemSetAligned is the same as MemSet except it omits the test to see if
   * "start" is word-aligned.  This is okay to use if the caller knows a-priori
--- 643,648 ----
***************
*** 657,663 ****
  \
  		if ((_len & INT_ALIGN_MASK) == 0 && \
  			_val == 0 && \
! 			_len <= MEMSET_LOOP_LIMIT) \
  		{ \
  			int32 *_stop = (int32 *) ((char *) _start + _len); \
  			while (_start < _stop) \
--- 658,665 ----
  \
  		if ((_len & INT_ALIGN_MASK) == 0 && \
  			_val == 0 && \
! 			_len <= MEMSET_LOOP_LIMIT && \
! 			MEMSET_LOOP_LIMIT != 0) \
  		{ \
  			int32 *_stop = (int32 *) ((char *) _start + _len); \
  			while (_start < _stop) \
***************
*** 679,684 ****
--- 681,687 ----
  #define MemSetTest(val, len) \
  	( ((len) & INT_ALIGN_MASK) == 0 && \
  	(len) <= MEMSET_LOOP_LIMIT && \
+ 	MEMSET_LOOP_LIMIT != 0 && \
  	(val) == 0 )
  
  #define MemSetLoop(start, val, len) \
Index: src/include/pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v
retrieving revision 1.90
diff -c -c -r1.90 pg_config.h.in
*** src/include/pg_config.h.in	17 Jan 2006 23:52:31 -0000	1.90
--- src/include/pg_config.h.in	3 Feb 2006 13:48:12 -0000
***************
*** 576,581 ****
--- 576,584 ----
  /* Define as the maximum alignment requirement of any C data type. */
  #undef MAXIMUM_ALIGNOF
  
+ /* Define bytes to use libc memset(). */
+ #undef MEMSET_LOOP_LIMIT
+ 
  /* Define to the address where bug reports for this package should be sent. */
  #undef PACKAGE_BUGREPORT
  
Index: src/template/aix
===================================================================
RCS file: /cvsroot/pgsql/src/template/aix,v
retrieving revision 1.17
diff -c -c -r1.17 aix
*** src/template/aix	2 Dec 2004 18:11:40 -0000	1.17
--- src/template/aix	3 Feb 2006 13:48:13 -0000
***************
*** 8,10 ****
--- 8,14 ----
        ;;
    esac
  fi
+ 
+ # native memset() is faster, 2006-02-03
+ # XLC 6.0, (IBM's cc), tested on AIX 5.2 and 5.1
+ MEMSET_LOOP_LIMIT=0
