From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: efficiency question on text manipulation using string vs buffer Date: Tue, 24 Mar 2009 15:26:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: <547159b6-2091-46d8-8d2d-08037fae01d3@p42g2000prp.googlegroups.com> References: <01cc8ac5-0b6c-4f7f-8018-73e644b8bf17@p6g2000pre.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1237957474 16582 80.91.229.12 (25 Mar 2009 05:04:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Mar 2009 05:04:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 25 06:05:51 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 1LmLIW-0005Wk-01 for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Mar 2009 06:05:10 +0100 Original-Received: from localhost ([127.0.0.1]:60742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmLH8-0007qb-V2 for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Mar 2009 01:03:39 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!p42g2000prp.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 19 Original-NNTP-Posting-Host: 24.6.175.142 Original-X-Trace: posting.google.com 1237933587 9298 127.0.0.1 (24 Mar 2009 22:26:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 24 Mar 2009 22:26:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p42g2000prp.googlegroups.com; posting-host=24.6.175.142; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:167955 X-Mailman-Approved-At: Wed, 25 Mar 2009 00:58:28 -0400 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:63252 Archived-At: On Mar 24, 1:19 pm, Nikolaj Schumacher wrote: > XahLee 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 actuall= y > happens in this case. The majority of time is probably spent on the > regexp search anyway, making direct comparison moot. Thanks. Xah =E2=88=91 http://xahlee.org/ =E2=98=84