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.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Fri, 05 Aug 2022 17:16:58 +0300 Message-ID: <83tu6qzsf9.fsf@gnu.org> References: <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> <8c7321f2f36494299e61@heytings.org> <8c7321f2f336523624e3@heytings.org> <83r1202meh.fsf@gnu.org> <6020ffaf-9069-0070-76cf-a13379ef01b5@yandex.ru> <83les71ilg.fsf@gnu.org> <06c5560d-3009-e5a5-3d33-fe5d2ec32d6b@yandex.ru> <74ddc877f17a06d8f120@heytings.org> <100d08b3-c25b-683f-6def-39052107ab59@yandex.ru> <83h72r16g1.fsf@gnu.org> <640c2e07-98e1-96d6-bb02-19f5f03f637f@yandex.ru> <834jyq29o1.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31152"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 05 16:23:07 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1oJyEF-0007vU-BP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 16:23:07 +0200 Original-Received: from localhost ([::1]:56982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJyEE-0005gY-Bj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 10:23:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJy9L-0000kB-0P for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 10:18:12 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJy9K-0005H4-O6 for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 10:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJy9K-0003tA-HL for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 10:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Aug 2022 14:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165970903214890 (code B ref 56682); Fri, 05 Aug 2022 14:18:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 5 Aug 2022 14:17:12 +0000 Original-Received: from localhost ([127.0.0.1]:60188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJy8W-0003s6-8K for submit@debbugs.gnu.org; Fri, 05 Aug 2022 10:17:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJy8S-0003rp-3o for 56682@debbugs.gnu.org; Fri, 05 Aug 2022 10:17:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJy8M-0005CX-0f; Fri, 05 Aug 2022 10:17:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=CB0QyFOqFxoHTjfxnws3p9eiX+Q3wSO20p5RYh3uMrI=; b=f4AvZeEgJh9d UKXkttIy+T7H6mOrzzXcBJ42J98ktZSYEKu+d7PGliGcCD6eValPBZZgpO2Q2arYSwHYn7dA5xSip 8DlSprHX7df1STeOVaVsGvLDrVYGsOAYlFnhEjYfxhM3DKpaVlhyjY5DI6/I2o4OqA2zuVFspXsBh mYxxBopHZX/RddcNTkI4kRTtF+YJT16djyHjxeZwGG5xINNi7wTXRqFN2+69Ci8XLVkFDxxlA0JIQ DnAUSpiFZJSbrj2435u3q+qq0/A4/73k0J22dgsn8YfCN+U4sMcliufvTMmuKl0/fcsNJGBKxQYO5 YlqRC1l0S1gxtcUeCJlqgA==; Original-Received: from [87.69.77.57] (port=1905 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 1oJy8K-0003jf-O1; Fri, 05 Aug 2022 10:17:01 -0400 In-Reply-To: (message from Dmitry Gutov on Fri, 5 Aug 2022 15:08:22 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238923 Archived-At: > Date: Fri, 5 Aug 2022 15:08:22 +0300 > Cc: gregory@heytings.org, 56682@debbugs.gnu.org, monnier@iro.umontreal.ca > From: Dmitry Gutov > > > The current opinion of both the head maintainers and of Gregory is > > that these are all parts of the same problem, and a single class of > > solutions can solve most of them. > > This kind of approach fails to optimize for the behavior in medium-sized > files, like the downloadify.js I showed previously. > > Simply customizing long-line-threshold to a much higher value will bring > back redisplay stutters on C-n/C-p/etc, which *were* a real problem that > some of Gregory's changes solved. You want a separate threshold for calling font-lock from redisplay? We could discuss that. > > The problem being that many > > portions of Emacs code involved in navigation and redisplay don't > > expect lines to be too long, and therefore employ algorithms that > > don't scale well with line length. > > As I demonstrated, font-lock itself doesn't have that issue. What do you mean by "font-lock itself"? > Furthermore, the performance problem with syntax-ppss which we are > talking about now doesn't have anything to do long lines. The facts are that it has problems in large files, but it also has problems in not-so-large files with long lines, due to whole-line approach. > Go ahead and pretty-print dictionary.json (you can use 'M-x > json-pretty-print', write the buffer to a new file, then re-visit it). > There won't be any long lines in the resulting file, but 'M->' will > still make you wait a few seconds the first time. No one said that the changes being discussed solve all the problems in Emacs. > > I get it that you disagree, but I haven't seen any real data behind > > your dissenting opinions, and thus I don't yet see any reason to > > reconsider changing the direction of development in this regard. > > I don't understand why you dismiss the more subtle approach which still > seems to reach the stated goals. > > Gregory's changes, along with my suggested tweak, indeed bring work > "surprisingly well" already. All without breaking font-lock in the > common case. I don't think I understand what "tweak" you are suggesting. can you show a patch relative to the current master? > Like, we're going from a 255 (?) second delay to 2 second delay already > without breaking fontification. And yet you're eager to go from 2 > seconds down to ~0 and sacrifice highlighting correctness? Yes, because 2 sec (in an optimized build) is a very long time.