From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sujith Newsgroups: gmane.emacs.devel Subject: Slow fontification in C mode buffers Date: Sat, 3 Dec 2011 20:33:15 +0530 Message-ID: <20186.14899.446956.591200@gargle.gargle.HOWL> References: <83vcpxbxn0.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1322924635 23872 80.91.229.12 (3 Dec 2011 15:03:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 3 Dec 2011 15:03:55 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 03 16:03:50 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RWr81-0006og-BQ for ged-emacs-devel@m.gmane.org; Sat, 03 Dec 2011 16:03:50 +0100 Original-Received: from localhost ([::1]:37037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWr80-0007Ab-Sc for ged-emacs-devel@m.gmane.org; Sat, 03 Dec 2011 10:03:48 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWr7y-0007AU-K3 for emacs-devel@gnu.org; Sat, 03 Dec 2011 10:03:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWr7x-00057J-OK for emacs-devel@gnu.org; Sat, 03 Dec 2011 10:03:46 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:34912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWr7x-00057F-Jf; Sat, 03 Dec 2011 10:03:45 -0500 Original-Received: by iapp10 with SMTP id p10so3613288iap.0 for ; Sat, 03 Dec 2011 07:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:cc:subject:in-reply-to:references:x-mailer; bh=95Og28ls/yjg1T6K9Eoeqj22l3qswrJ8dVNCjjxV9WU=; b=G8N/FhkbmLFUMaGADggc6ylanGg7GhWQoRYVjNiBdgg9hIzVSV12GvgrRku+9nyNMi h3yLi0i4wTKrkXeA4+At1HsGdyydzdzozqoK0PgqyRzPJNX89ZErrjqxUS3r9rP03gQx 3nM7hmacCQnBQHMBdrA3JX+/AFdSEo6ILxV98= Original-Received: by 10.42.131.135 with SMTP id z7mr2810997ics.23.1322924624440; Sat, 03 Dec 2011 07:03:44 -0800 (PST) Original-Received: from ariyasavaka ([14.96.185.78]) by mx.google.com with ESMTPS id l28sm49359519ibc.3.2011.12.03.07.03.40 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 03 Dec 2011 07:03:43 -0800 (PST) In-Reply-To: <83vcpxbxn0.fsf@gnu.org> X-Mailer: VM 8.2.0a under 23.3.1 (i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146461 Archived-At: Eli Zaretskii wrote: > Did anyone else notice that scrolling the first time through a very > large comment in C mode became extremely slow lately? For example, > visit xdisp.c in "emacs -Q", type M-<, then hit C-v several times in > quick succession. Then watch in disbelief how long it takes for Emacs > to scroll by these several screenfuls. In my case (6.5 year old > hardware), I even see the "hourglass cursor" kick in, and the CPU > meter shows 100% utilization of one execution unit for about 5 > seconds. > > If you then type M-< and again hit C-v several times, scrolling will > be at its usual speed. Scrolling outside of large comments is also > reasonably fast, even for the first time. > > Therefore, my prime suspect is font-lock, which is triggered by the > need to display a portion of the buffer that was not fontified yet. > This suspicion is corroborated by the fact that jit-stealth font-lock > of xdisp.c causes extremely high peaks of CPU usage, and Emacs > response time becomes very sluggish. > > Is there something in C Mode's arrangements for fontification, > specifically related to comments, that was changed lately and that can > explain this slowdown? I can see this behavior on a low-spec machine - Intel Atom @ 1.66 GHz with 1GB RAM running GNU/Linux. C mode is really slow with maximum font-lock decoration and hitting C-v a few times is enough for the screen to lock up, while the CPU chugs away at full usage. After the buffer has been fully fontified, scrolling is fast. My current workaround is to set font-lock-maximum-decoration to 2. I tried the pretests to see if things have changed, but 24.0.92 has pretty much the same behavior. Sujith