From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Fri, 11 Jun 2021 22:31:45 +0300 Message-ID: <837dj09p0e.fsf@gnu.org> References: <62e438b5-d27f-1d3c-69c6-11fe29a76d74@dancol.org> <83fsxsdxhu.fsf@gnu.org> <83pmwudgw3.fsf@gnu.org> <83k0n2cjg5.fsf@gnu.org> <83im2lbqmv.fsf@gnu.org> <179f6e4fa40.2816.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <83fsxpbpn9.fsf@gnu.org> <83k0n09tkp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33325"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, dancol@dancol.org, emacs-devel@gnu.org, rms@gnu.org, rudalics@gmx.at To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 11 21:32:53 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrmtg-0008Re-Lg for ged-emacs-devel@m.gmane-mx.org; Fri, 11 Jun 2021 21:32:52 +0200 Original-Received: from localhost ([::1]:53930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrmte-0002hl-Oa for ged-emacs-devel@m.gmane-mx.org; Fri, 11 Jun 2021 15:32:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrmst-00020v-C0 for emacs-devel@gnu.org; Fri, 11 Jun 2021 15:32:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38706) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrmsr-0004oS-4S; Fri, 11 Jun 2021 15:32:01 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1522 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrmsk-0000k5-MB; Fri, 11 Jun 2021 15:31:55 -0400 In-Reply-To: (message from Stefan Monnier on Fri, 11 Jun 2021 14:42:31 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270720 Archived-At: > From: Stefan Monnier > Cc: Eli Zaretskii , Alan Mackenzie , > rudalics@gmx.at, rms@gnu.org, emacs-devel@gnu.org > Date: Fri, 11 Jun 2021 14:42:31 -0400 > > I used pretty much your above test, except I started it at BOB of > xdisp.c and used: > > M_: (dotimes (_ 700) > (message "%S" (benchmark-elapse (scroll-up) (sit-for 0))) > (sleep-for 0.05)) > > As you can see, the speed doesn't get noticeably worse as we go further > into the file (the first few screenfuls were a bit faster, but after > that it's a wash). Can you produce a profile for that? > Eli, do you see similar results? Will Emacs 27.2 do? If you must see results from an optimized build of Emacs 28, I'll have to build one first. > Would you say that this shows the slow behaviors that bother you? Of course. 100 msec for a single window-scroll is awfully slow. Especially since the display code itself takes only a fraction of that time. > E.g. there used to be a time where I found CC-mode unusably slow in some > cases, but these were typically while editing rather than while > scrolling (i.e. even simple buffer modifications incurred delays > measured in seconds). Yes, there are other use cases, but even this simple benchmark already shows that we have a serious problem, IMO. Compare this with Emacs 23 or with Emacs 28 in Fundamental mode. > FWIW, I ran this same test with `sm-c-mode` (which should handle `xdisp.c` > about as well as CC-mode, but solves an easier problem since it doesn't > try to handle as much of C as CC-mode does (e.g. no support for K&R, no > highlighting of types), nor does it try to handle C++, Java, ...), and > most of the times for it are between 0.02 and 0.04. That is much better, but still too slow, IMO. Think: it's the time that it takes us to fontify a single windowful, only a couple of dozens of lines. Why does it take so long?