From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Fri, 5 Aug 2022 14:34:12 +0300 Message-ID: <640c2e07-98e1-96d6-bb02-19f5f03f637f@yandex.ru> 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> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11769"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 05 13:36:41 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 1oJvdB-0002un-4w for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 13:36:41 +0200 Original-Received: from localhost ([::1]:42426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJvd8-0002NZ-N2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 07:36:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJvbc-0002Ci-GV for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 07:35:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJvba-0004zh-9c for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 07:35:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJvba-0004nE-1t for bug-gnu-emacs@gnu.org; Fri, 05 Aug 2022 07:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Aug 2022 11:35: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.165969926718376 (code B ref 56682); Fri, 05 Aug 2022 11:35:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 5 Aug 2022 11:34:27 +0000 Original-Received: from localhost ([127.0.0.1]:56377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJvb0-0004mJ-Hc for submit@debbugs.gnu.org; Fri, 05 Aug 2022 07:34:26 -0400 Original-Received: from mail-wm1-f44.google.com ([209.85.128.44]:46805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJvav-0004m2-3X for 56682@debbugs.gnu.org; Fri, 05 Aug 2022 07:34:25 -0400 Original-Received: by mail-wm1-f44.google.com with SMTP id j4-20020a05600c1c0400b003a4f287418bso1150554wms.5 for <56682@debbugs.gnu.org>; Fri, 05 Aug 2022 04:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=MuOqGiNH4RV7EUhcMQhOHgHpFByIigHaA9UAgNIhXRs=; b=KJPC/Ac/mUuK9oeGayU3qmjuyWFrpQ+dr9Xfc8tLNoTiE0NiTS0Mmnl/KiInswmmVP jvN2b0WTcJlx7Wt95+wmmhsEkDRliuWqHTfBI0ZPv4JXEpah4JqUQnuAtTiOc2pYIqeX yvZ/GckMXWiXGmOtVuN61IChNIqiscCil6VY0W1lIooHCw99v0IgJTb2P12CiarAEbEK DenfzOonUhHlDpxVHwu2r/+bIy8NERjE88Iluyts6MvDMDnRl0U2sD6COee9dxf9Zyce ppGejS8UrXuS3392bOdNgRMeJLNZXoTjaFKBICGZGTFtWM1YW4EkHVGO2/kbobSYLfg1 2rjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=MuOqGiNH4RV7EUhcMQhOHgHpFByIigHaA9UAgNIhXRs=; b=daMFXzbvTJdtKKOsssDiEVd6zRl5IxL5u2y8ZtOBbACXkhQhv9ssREefhgwoQHsR1n QPjX49etaQ7eFK62YgbZdx8iV64f1l11ieb5LH152UmWhO3j1PIv9/ISclFRMgIIG3if 6bpuITknYfBSJ0MBYvqHjl6fNrLWIoGI6SmhaH2mlgNnpbcltAHafs9q6oL10wNTrk/W Dsyg0UNQTPj7hHhKqtO1EwsKLwJgpVh5hNq1pSyZ34k/vdtAbiTj+l+xgWhLOs94YBCd dPgS+nJprBo+prZuHKuQRxiw0f5qVOTyA6ZV3xrThqEpu67OMR5Ragke5Sq2yeK9P+O7 wBJw== X-Gm-Message-State: ACgBeo0RYulOVD2tGlOSrrRn1xN5HILT02D4sBLgUyLIcMhjqkj7jbVp h+4Yj7w0zdZ6m+dy4zeiTjc= X-Google-Smtp-Source: AA6agR59qt/nKt2iaGG5YKcL3arHqCpBV0QusxKJ/77x+k16bwXHXlMntv/9z/iwQUHscrechz3JvQ== X-Received: by 2002:a05:600c:503:b0:3a3:29ec:cd0 with SMTP id i3-20020a05600c050300b003a329ec0cd0mr8958667wmc.63.1659699254954; Fri, 05 Aug 2022 04:34:14 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u13-20020a5d434d000000b0021e74ef5ae8sm3690701wrr.21.2022.08.05.04.34.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Aug 2022 04:34:14 -0700 (PDT) Content-Language: en-US In-Reply-To: <83h72r16g1.fsf@gnu.org> 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:238861 Archived-At: On 05.08.2022 10:43, Eli Zaretskii wrote: >> Date: Fri, 5 Aug 2022 05:03:39 +0300 >> Cc: 56682@debbugs.gnu.org, Eli Zaretskii , >> monnier@iro.umontreal.ca >> From: Dmitry Gutov >> >> That was about a 1 GB buffer, right? >> >> Let's take care of buffers with more reasonable sizes first, and then we >> can consider extremes. > > We want to solve all of them. I didn't say we don't. But different issues call for different solutions. >> A separate threshold for syntax-ppss to avoid parsing the whole >> buffer might fit the bill. > > Don't we already have such a threshold? Not exactly: the buffer is still fully parsed by parse-partial-sexp (once). AFAICT, the variable makes the application of syntax-propertize-rules more lax, but at least it keeps counting the simple parens/quotes from the beginning of the buffer. That's why the fontification remained correct in both examples that I posted. The time it takes to (parse-partial-sexp 1 (point-max)) accounts for the whole fontification delay at the end of dictionary.json. Now, if nobody manages to speed up parse-partial-sexp itself further, we can add an additional tweak/size threshold, after which syntax-ppss won't parse the whole buffer anymore. But if we do that in Lisp, we can later improve that bit of logic so that the result is not entirely arbitrary, like it is now on master with dictionary.json. > But again, if you are just saying that the current balance between > response time and font-lock correctness is sub-optimal, and should be > made better by changing the values of the thresholds, that's a > different discussion. For that discussion, we'd need a representative > enough sample of real-life files with long lines and in as many major > modes as possible, to make our balance really close to optimal. I, > for one, will welcome more examples of such files, especially if they > use major modes we didn't consider until now. We really have different problems and thus need different solutions for them. Not just one blunt instrument.