From xemacs-m  Wed Sep 10 13:47:25 1997
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id NAA24371
	for <xemacs-beta@xemacs.org>; Wed, 10 Sep 1997 13:47:24 -0500 (CDT)
Received: from Eng.Sun.COM ([129.146.1.25]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id LAA06079; Wed, 10 Sep 1997 11:46:56 -0700
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id LAA14008; Wed, 10 Sep 1997 11:46:53 -0700
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id LAA04559; Wed, 10 Sep 1997 11:46:51 -0700
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id LAA25654; Wed, 10 Sep 1997 11:46:49 -0700
Date: Wed, 10 Sep 1997 11:46:49 -0700
Message-Id: <199709101846.LAA25654@xemacs.eng.sun.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: David Bakhash <cadet@mit.edu>
Cc: xemacs-beta@xemacs.org
Subject: free speed-up
In-Reply-To: <199709101832.OAA03108@rattlesnake>
References: <199709101832.OAA03108@rattlesnake>
X-Mailer: VM 6.33 under 20.3 "Vienna" XEmacs  Lucid (beta14)
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>

>>>>> "David" == David Bakhash <cadet@mit.edu> writes:

David> hey,
David> 	in lisp/prim/subr.el I was using the macro
David> `with-string-as-buffer-contents' and noticed that it does an
David> `erase-buffer' before and after it handles its forms.  The one before
David> is absolutely essential, but the one that takes place as it exists is
David> absolutely unecessary.

David> dave

David> *** subr.el	Sat Mar  8 21:37:43 1997
David> --- /tmp/subr.el	Wed Sep 10 14:26:10 1997
David> ***************
David> *** 357,363 ****
David>              (insert ,str)
David>              ,@body
David>              (buffer-string))
David> -        (erase-buffer tempbuf)
David>          (set-buffer curbuf))))
  
David>   (defun insert-face (string face)
David> --- 357,362 ----

I think this is false economy.  If the string is huge, then that temp
buffer is going to bloat XEmacs' memory size.  Unless you *know* you
are going to call with-string-as-buffer-contents again real soon, it's 
likely even faster to just call erase-buffer.

If you have a performance critical loop that calls
with-string-as-buffer-contents, it likely should be re-engineered
anyways to only do buffer manipulations in its own buffer.

Martin

