From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7089: 23.2; slow ansi-color-apply Date: Sun, 31 Oct 2010 15:10:32 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1288552441 8035 80.91.229.12 (31 Oct 2010 19:14:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 31 Oct 2010 19:14:01 +0000 (UTC) Cc: 7089@debbugs.gnu.org To: Leo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 31 20:13:56 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 1PCdLk-0001WX-4x for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Oct 2010 20:13:52 +0100 Original-Received: from localhost ([127.0.0.1]:49440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCdLj-0002Sg-BV for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Oct 2010 15:13:51 -0400 Original-Received: from [140.186.70.92] (port=42236 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCdLU-0002S5-B8 for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2010 15:13:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCdLA-00021y-EB for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2010 15:13:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCdLA-00021u-BI for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2010 15:13:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCdF7-0003HU-TQ; Sun, 31 Oct 2010 15:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Oct 2010 19:07:01 +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.128855197812606 (code B ref 7089); Sun, 31 Oct 2010 19:07:01 +0000 Original-Received: (at 7089) by debbugs.gnu.org; 31 Oct 2010 19:06:18 +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 1PCdEP-0003HH-Ka for submit@debbugs.gnu.org; Sun, 31 Oct 2010 15:06:17 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCdEN-0003HB-NR for 7089@debbugs.gnu.org; Sun, 31 Oct 2010 15:06:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskIAG9bzUxFpYZA/2dsb2JhbACgSX5yuWOFRASSKw X-IronPort-AV: E=Sophos;i="4.58,268,1286164800"; d="scan'208";a="81202416" Original-Received: from 69-165-134-64.dsl.teksavvy.com (HELO pastel.home) ([69.165.134.64]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 31 Oct 2010 15:10:33 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A1397A8621; Sun, 31 Oct 2010 15:10:32 -0400 (EDT) In-Reply-To: (Leo's message of "Thu, 28 Oct 2010 12:03:18 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 31 Oct 2010 15:07:01 -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:41311 Archived-At: >>> 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? > 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