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 22:14:52 +0300 Message-ID: <83edxuzemr.fsf@gnu.org> References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> <8c7321f2f36494299e61@heytings.org> <83v8rc2n1h.fsf@gnu.org> <64084296-1953-8ef8-5938-adfb6fb9b43f@yandex.ru> <83r11uzs8n.fsf@gnu.org> <14845631-c2ef-8371-8606-c858092e3192@yandex.ru> <83mtcizov2.fsf@gnu.org> <83h72qzheq.fsf@gnu.org> <25717d84-3411-a93a-3620-e04fe0571aff@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37772"; 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 21:16:45 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 1oK2oP-0009dy-KO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 21:16:45 +0200 Original-Received: from localhost ([::1]:54232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK2oO-00060T-Fe for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 15:16:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK2ni-0005xB-E1 for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 15:16:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK2ni-0007PQ-5I for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 15:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oK2nh-0007id-Sw for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 15:16:01 -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 19:16:01 +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.165972690429596 (code B ref 56682); Fri, 05 Aug 2022 19:16:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 5 Aug 2022 19:15:04 +0000 Original-Received: from localhost ([127.0.0.1]:60609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oK2mm-0007hI-8l for submit@debbugs.gnu.org; Fri, 05 Aug 2022 15:15:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oK2mi-0007gS-CI for 56682@debbugs.gnu.org; Fri, 05 Aug 2022 15:15:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK2mb-00072l-O2; Fri, 05 Aug 2022 15:14:53 -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=3uU8EIlKRS6BcOQvPHU1CqD8pMJJBkHNKyPOUx2CYjY=; b=d067TMoov2bW PA6huIw18aKsmzHQElQWsFgAsLmLPiz0dmGd4xcoy1jLzVbtlVYTLh1KJk28VRUcWVfzTNOCrZ510 x1NfokTijzucb7QDZwPOBNhIzA+dqK7DZY09AZI49fA+oDOOn9c+9Ls6k6kDv2wVllciM1NDZrC5G kTgMDeOT/wfURAIInR2VHAX4cLfXKInYPFPod0XeTDofTZlnRCoKBSWinZBA2UVIz9DktnhPrRERD PAkrDbQMmH4t+3kQ0D6vsQcPgN7RF2vz8XwnTgLANT6X6lYtpTR9Dj9c13vdzkZUcXWmVNyRH/JCM dZ5yrm3Q9i+NTnY89EzcMw==; Original-Received: from [87.69.77.57] (port=1539 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 1oK2mb-0005PT-7N; Fri, 05 Aug 2022 15:14:53 -0400 In-Reply-To: <25717d84-3411-a93a-3620-e04fe0571aff@yandex.ru> (message from Dmitry Gutov on Fri, 5 Aug 2022 22:01:24 +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:238940 Archived-At: > Date: Fri, 5 Aug 2022 22:01:24 +0300 > Cc: 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca > From: Dmitry Gutov > > > First, we need to establish that indeed parse-partial-sexp is called > > in that manner in the relevant major modes (not just one of them), or > > by font-lock itself regardless of the mode. > > It is called by font-lock itself, which ends up calling syntax-ppss, > which does its job with parse-partial-sexp. In all modes, regardless of what the mode wants to highlight? > > Second, we need to establish that indeed this takes a large portion of > > the time in the slow operations. Not just one particular operation, > > but most or all of them. > > To establish that, I have described the experiment in the grandparent > email (with scenarios 1,2a;1,2b;1,2a,2b), and performed it myself as well. > > But I'm talking about the slowdown observed when doing 'M->'. Not about > any operations one might try to perform. Having said that, after the > initial 'M->' most of navigation operations look snappy to me. So that's > the slowdown I decided to investigate. We need to look at more than just M->. C-n/C-p, C-v/M-v, C-l are also important, as are the time it takes from typing M-x or M-: until you see the prompt in the minibuffer, and the time to update the display after inserting or deleting a single character. > All major modes we can currently use for JSON (the built-in js-mode and > the two json-mode's in ELPA) inherit the value of > syntax-propertize-function from js-mode. But there's no need for it: > JSON doesn't have division, or regexps, or preprocessor directives, or > embedded JSX structures. > > Setting syntax-propertize-function to nil speeds up parse-partial-sexp > significantly. Thanks, so I guess we may have a solution for JSON files, if disabling syntax-propertize-function doesn't have any downsides. What about other modes that we see in files with long lines, like XML? And how scalable is the solution you propose, i.e. how it behaves in JSON files with a much longer lines?