From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: efficiency question on text manipulation using string vs buffer Date: Tue, 24 Mar 2009 21:19:58 +0100 Message-ID: References: <01cc8ac5-0b6c-4f7f-8018-73e644b8bf17@p6g2000pre.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1237926180 2212 80.91.229.12 (24 Mar 2009 20:23:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Mar 2009 20:23:00 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Xah Lee Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 24 21:24:18 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LmDAX-0000aB-Eb for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2009 21:24:17 +0100 Original-Received: from localhost ([127.0.0.1]:58634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmD9A-0005D0-9r for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2009 16:22:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmD6Q-0004Cy-Ir for help-gnu-emacs@gnu.org; Tue, 24 Mar 2009 16:20:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmD6P-0004C6-KI for help-gnu-emacs@gnu.org; Tue, 24 Mar 2009 16:20:01 -0400 Original-Received: from [199.232.76.173] (port=55751 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmD6P-0004Bu-Fh for help-gnu-emacs@gnu.org; Tue, 24 Mar 2009 16:20:01 -0400 Original-Received: from dd18200.kasserver.com ([85.13.138.168]:57198) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LmD6P-0006iw-7A for help-gnu-emacs@gnu.org; Tue, 24 Mar 2009 16:20:01 -0400 Original-Received: from thursday (e179203095.adsl.alicedsl.de [85.179.203.95]) by dd18200.kasserver.com (Postfix) with ESMTP id B45DD182E7FD0; Tue, 24 Mar 2009 21:20:03 +0100 (CET) In-Reply-To: <01cc8ac5-0b6c-4f7f-8018-73e644b8bf17@p6g2000pre.googlegroups.com> (Xah Lee's message of "Mon, 23 Mar 2009 18:41:08 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (darwin) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63239 Archived-At: Xah Lee wrote: > It appears to me, testing these commands on a text selection with > about 122k chars that needs to be replaced, the second version is only > 1 second slower? (both finishes within 2 or 3 seconds, on a 2007 > midrange PC) You should note that the replace-string function is pretty smart. It only does one big concat, so not that much string manipulation actually happens in this case. The majority of time is probably spent on the regexp search anyway, making direct comparison moot. regards, Nikolaj Schumacher