From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: with-output-to-temp-buffer Date: Thu, 1 Jun 2006 15:53:26 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1149202441 13196 80.91.229.2 (1 Jun 2006 22:54:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Jun 2006 22:54:01 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 02 00:53:58 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Flw32-0007pb-R9 for ged-emacs-devel@m.gmane.org; Fri, 02 Jun 2006 00:53:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Flw32-0005wx-FZ for ged-emacs-devel@m.gmane.org; Thu, 01 Jun 2006 18:53:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Flw2s-0005ws-9F for emacs-devel@gnu.org; Thu, 01 Jun 2006 18:53:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Flw2p-0005wg-Q3 for emacs-devel@gnu.org; Thu, 01 Jun 2006 18:53:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Flw2p-0005wd-Ld for emacs-devel@gnu.org; Thu, 01 Jun 2006 18:53:35 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1Flw9A-00055F-GK for emacs-devel@gnu.org; Thu, 01 Jun 2006 19:00:08 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k51MrXlV001166 for ; Thu, 1 Jun 2006 16:53:33 -0600 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k51MrWGR020359 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 1 Jun 2006 16:53:32 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:55585 Archived-At: I had this code: (set-buffer (get-buffer-create "foo")) (let (...) ...) (select-frame (make-frame ...)) I changed it to this code: (with-output-to-temp-buffer "foo" ...) (let ((temp-buffer-setup-hook nil) (temp-buffer-show-functions nil) ...) ...) (select-window (get-buffer-window "foo" 'visible)) (modify-frame-parameters (selected-frame) ...) The rest of the code (i.e. "...") is identical. The latter code runs about twice as fast (clock time)! I don't use any print functions inside the with-* - I use only `insert', so I wouldn't think that with-* would be of any special benefit here. I don't understand this. A glance at the C code makes me think that with-output-to-temp-buffer would only do more, not less, stuff. (Thinking that the difference might be make-frame vs modify-frame-parameters, I tried using modify-frame-* for the first code too, but that made no difference. I guess it must be with-* that speeds things up.) Is this to be expected? If so, should something be said about this in the doc - for example, say something about what with-output-* does, and mention that it might be faster than creating and setting a buffer?