From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Very long lines in shell-mode Date: Wed, 06 Dec 2006 23:59:33 -0500 Message-ID: References: <87zma0gbr5.fsf@pacem.orebokech.com> Reply-To: rms@gnu.org NNTP-Posting-Host: dough.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1165467660 26208 80.91.229.10 (7 Dec 2006 05:01:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 7 Dec 2006 05:01:00 +0000 (UTC) Cc: romain@orebokech.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 07 06:00:59 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GsBNP-0001BI-S3 for ged-emacs-devel@m.gmane.org; Thu, 07 Dec 2006 06:00:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GsBNP-0003sn-Ip for ged-emacs-devel@m.gmane.org; Thu, 07 Dec 2006 00:00:55 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GsBM7-0002uG-V9 for emacs-devel@gnu.org; Wed, 06 Dec 2006 23:59:36 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GsBM7-0002te-5p for emacs-devel@gnu.org; Wed, 06 Dec 2006 23:59:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GsBM6-0002tX-Qc for emacs-devel@gnu.org; Wed, 06 Dec 2006 23:59:34 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GsBM6-0006hK-UO for emacs-devel@gnu.org; Wed, 06 Dec 2006 23:59:35 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.52) id 1GsBM5-00026X-Jm; Wed, 06 Dec 2006 23:59:33 -0500 Original-To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Wed, 06 Dec 2006 13:10:49 -0500) 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:63394 Archived-At: Most likely the 2MB line will be inserted in the buffer in many little chunks of maybe 4KB or so: for each chunk font-lock may decide to refontify the whole line. Each fontification step takes time proportional to the length of the line, so you get O(n^2) behavior. And this is without even considering the regexps involved which may very likely add a factor of n to that. Maybe for such cases, font-lock should have a "sanity check" and either not fontify the line at all, or fontify only a part of it at a time. A possible simple solution: in Shell mode, don't fontify a line that doesn't end in a newline. If that solves the problem, it would be simple enough to install now.