From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: What is the _essential_ difference between lazy-lock and jit-lock? Date: 26 Jan 2004 16:46:16 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <9f3pub.9a.ln@acm.acm> <94lpub.q5.ln@acm.acm> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075154192 16657 80.91.224.253 (26 Jan 2004 21:56:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2004 21:56:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jan 26 22:56:26 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AlEiY-0007hT-00 for ; Mon, 26 Jan 2004 22:56:26 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AlEiX-0008ED-00 for ; Mon, 26 Jan 2004 22:56:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AlEiH-0001BL-K6 for emacs-devel@quimby.gnus.org; Mon, 26 Jan 2004 16:56:09 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AlEhu-0001AO-1l for emacs-devel@gnu.org; Mon, 26 Jan 2004 16:55:46 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AlEhN-0000xm-3V for emacs-devel@gnu.org; Mon, 26 Jan 2004 16:55:45 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AlEfe-0000LT-E5 for emacs-devel@gnu.org; Mon, 26 Jan 2004 16:53:26 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by mx20.gnu.org with esmtp (Exim 4.24) id 1AlEZW-0006Sj-5q for emacs-devel@gnu.org; Mon, 26 Jan 2004 16:47:06 -0500 Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 9B1462102D for ; Mon, 26 Jan 2004 16:46:16 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 8A56D8C6F9; Mon, 26 Jan 2004 16:46:16 -0500 (EST) Original-Newsgroups: gnu.emacs.help Original-Lines: 47 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 In-Reply-To: Posted-To: gnu.emacs.help X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=0, requis 5) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19501 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19501 The following message is a courtesy copy of an article that has been posted to gnu.emacs.help as well. [ I suggest we move this to emacs-devel, which I Cc'd. ] >> I'm pretty sure I've seen this report (although I can't remember it), >> but it sounds like a different problem than just tuning, more like a >> real bug, probably a bad-regexp in the font-lock settings of a >> major-mode (the potentially exponential behavior of the current >> regexp-engine is a common problem). This was probably compounded by >> the fact that inhibit-quit is set during stealth fontification (input >> is polled instead). > More info: When Emacs hangs in this manner, a double C-g followed by > `fg' often (but not always) brings forth this: > : Garbage collection in progress; cannot auto-save now > : but will instead do a real quit after garbage collection ends > : Abort (and dump core)? (y or n) > On replying `n', Emacs frees up again. Left undisturbed it frequently > goes back into the hung state. > I conjecture that complicated regexps in font-lock settings are somehow > creating garbage at a fabulous rate, and jit-lock and the GC are somehow > thrashing. Just as soon as jit-lock can be halted and the GC left in > peace, things return to OK. Hmm... the regexp-engine does not generate any garbage. If you're inside the GC, that means you're not inside the regexp-matcher. So clearly the bug is different. A backtrace (and an xbacktrace) would be helpful. > I've just noticed something: jit-lock-stealth-load seems to be set by > default to 200%. This seems strange. Should this perhaps be 20%. ;-) Have you tried to change it? 200% indeed sounds too high. But on my single-user Opteron workstation, with no particular background task I currently have 16% of CPU use, so a limit of 20% might be a bit low. Maybe 50% ? Playing with jit-lock-stealth-nice is also a good idea. The only problem with it is that if your machine is very fast and takes 0.001s per chunk, waiting 0.125s between each chunk leads to ridiculously low CPU usage, whereas if each chunk takes 1s, then waiting 0.125s between chunks still leads to more than 80% CPU usage. So maybe jit-lock-stealth should measure the time it takes for it to process one chunk and dynamically adapt jit-lock-stealth-nice so as to produce a given CPU usage. Stefan