From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7089: 23.2; slow ansi-color-apply Date: Tue, 02 Nov 2010 00:23:06 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1288632934 20547 80.91.229.12 (1 Nov 2010 17:35:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Nov 2010 17:35:34 +0000 (UTC) Cc: 7089@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 01 18:35:29 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PCyI3-00088E-Iy for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 18:35:27 +0100 Original-Received: from localhost ([127.0.0.1]:58737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCyI2-0001nC-BU for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 13:35:26 -0400 Original-Received: from [140.186.70.92] (port=54790 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCxin-00083H-Rb for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 12:59:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCxTb-0005a6-HH for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 12:43:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCxTb-0005a1-EQ for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 12:43:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCx66-0005DG-J4; Mon, 01 Nov 2010 12:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Nov 2010 16:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7089 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7089-submit@debbugs.gnu.org id=B7089.128862833820032 (code B ref 7089); Mon, 01 Nov 2010 16:19:02 +0000 Original-Received: (at 7089) by debbugs.gnu.org; 1 Nov 2010 16:18:58 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCx62-0005D3-Gk for submit@debbugs.gnu.org; Mon, 01 Nov 2010 12:18:58 -0400 Original-Received: from ppsw-52.csi.cam.ac.uk ([131.111.8.152]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCx60-0005Cy-Mo for 7089@debbugs.gnu.org; Mon, 01 Nov 2010 12:18:57 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from [59.57.34.138] (port=13187 helo=Victoria.local) by ppsw-52.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1PCxAB-0004Pk-EK (Exim 4.72) (return-path ); Mon, 01 Nov 2010 16:23:16 +0000 In-Reply-To: (Stefan Monnier's message of "Sun, 31 Oct 2010 15:10:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 01 Nov 2010 12:19:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41343 Archived-At: On 2010-11-01 03:10 +0800, Stefan Monnier wrote: >>>> The following version fixed some glitches in setting ansi-color-context. >>>> Also I have received an email from Alex that welcomes the improvement. >>>> Let me know if I should send a patch in. >>> Yes, a patch would be nice. Also a ChangeLog explaining the change >>> (which should hopefully explain why the new code is faster) would >>> be welcome. > >> Attached to the end of this message. I basically rewrite >> ansi-color-apply using re-search-forward (as in >> ansi-color-apply-on-region) which seems to be an order more efficient >> than string-match. > >> I have been using the new version in eshell and it is almost as >> efficient as ansi-color-apply-on-region. It is very painful to use the >> original ansi-color-apply. > > Any reason why your new code does something similar to > ansi-color-apply-on-region rather than calling > ansi-color-apply-on-region? `ansi-color-apply-on-region' uses overlays while `ansi-color-apply' uses text properties. >> Do you know for sure string-match is slower (more CPU intensive) than >> re-search-forward? > > They should be largely equivalent. The difference between the two > codes might be due to replace-match and substring. I.e. the original > ansi-color-apply should be at least as efficient as your code (if not > more) in the case where there are no SGR escape sequences. > > > Stefan Thanks for that info. Leo