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: Mon, 15 Aug 2022 23:17:46 +0300 Message-ID: <4ebdfdc3-4aeb-7ebb-b5ba-43b5c9b0aaa1@yandex.ru> References: <47894c57-dd8b-5778-240a-3fa6540e4d37@yandex.ru> <92da07bd02941d5537e9@heytings.org> <5308e3b5-a160-17d7-77ee-b1d00acfa20d@yandex.ru> <92da07bd02a6cc861e1a@heytings.org> <837d3lzv8n.fsf@gnu.org> <2c8d6755-cfe2-6559-3fde-3fa30ffb411e@yandex.ru> <83mtcgy44k.fsf@gnu.org> <83k07jx5jn.fsf@gnu.org> <866e510d-a060-7daa-d002-97861d056fa7@yandex.ru> <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> <12348081660379417@sas2-a098efd00d24.qloud-c.yandex.net> <66bbbb95983414e79637@heytings.org> <83wnb9hadb.fsf@gnu.org> <395454dd-7238-c5d0-e924-2f65a186baa7@yandex.ru> <83r11hh4pm.fsf@gnu.org> <3a1232a17b09ce88af40@heytings.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="28559"; 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, monnier@iro.umontreal.ca To: Gregory Heytings , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 15 22:19: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 1oNgYE-0007AF-56 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 22:19:06 +0200 Original-Received: from localhost ([::1]:59966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNgYC-0002HB-HH for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 16:19:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNgXC-0002Cn-Sx for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:18:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNgXC-00010X-Ey for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNgXC-00062Y-67 for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:18: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: Mon, 15 Aug 2022 20: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.166059468123211 (code B ref 56682); Mon, 15 Aug 2022 20:18:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 15 Aug 2022 20:18:01 +0000 Original-Received: from localhost ([127.0.0.1]:44148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNgXA-00062I-6O for submit@debbugs.gnu.org; Mon, 15 Aug 2022 16:18:01 -0400 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:42905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNgX4-00061u-UV for 56682@debbugs.gnu.org; Mon, 15 Aug 2022 16:17:59 -0400 Original-Received: by mail-wr1-f51.google.com with SMTP id z12so10262047wrs.9 for <56682@debbugs.gnu.org>; Mon, 15 Aug 2022 13:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=27/b4Ie0PcN6mjWwq48YAe7cLLbX3YzNxMkpNpwTrVw=; b=XxFFCosV2kPlIUgW2behUkd5oDp9m7gqjtNWtwy3yGesmmZTS4rf0fpgdczgXe/g9o zSzGq3goY61qh+5MtztC0ncnPDW6HcNfoyjqLYbTDFqnZb+nsHkjMAq3SmjT2Rw+pLFq 6Sa2hkJsc+yCz81bovo4ckYrYvOz3fwdR0loE5npV7Zyk2LVICpXQPtR75B98e/QlORm zYimPeCBgiPYYq9SqvbqWFB4m5JjDk7PX3U2OtD7t2gvK73mQ6VzWunon4j48lGrRZhD 1tW03EOmIRCTKJlV38O6NnCfmIz17JIIlsXXDw6ZWgaT1Jfxp1EYGF/fm50/UCSIy8L/ A/bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=27/b4Ie0PcN6mjWwq48YAe7cLLbX3YzNxMkpNpwTrVw=; b=FAmWa4kceArNtSALhxRMHfzJYhZxwINj/CEXT+yNQoeFhuuv+BuwU07U8vucHuoQNi fRZwwIftjG+9MgsafemiRKYVgdxwYi2u1Jg1fKWWb11YbgYg40VZ3d8aerHqWtcbEkkW NoudHRPZEKcrecr/XG1rNFLrlAP+B7YoykfDro29CJqQ6wsLjCiU7V09sStUpPTtYakP AR5zDozlqHDwpzN8A+T/Pa++RBk8Cn9g0VCtQmCXEF+0u+SH8aVkeeFABr0UdZnaQCBC SGwoFeOGapBVX7yfkMSoLdvP7By44i834CJtsZ7qSlTjW2xtJMgmX5XHdiqRqAR3rVqd hZQQ== X-Gm-Message-State: ACgBeo0vT29FSxrWa7bu7n44yl8dBPQCxbZZTf9H6tGqaEieY9te1WLG heYAFc17bqdKtLaTso5hbg4= X-Google-Smtp-Source: AA6agR7LLS/EKHxt5GPCDEl8L2I7VCJGLXa3NrkyQWwmxRorWIdEuHpJwtJBMJkCfuPbQlnhi+qbiA== X-Received: by 2002:a05:6000:1682:b0:221:599b:a41e with SMTP id y2-20020a056000168200b00221599ba41emr9545468wrd.522.1660594668863; Mon, 15 Aug 2022 13:17:48 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id x15-20020a5d490f000000b002205a5de337sm8046902wrq.102.2022.08.15.13.17.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 13:17:48 -0700 (PDT) Content-Language: en-US In-Reply-To: <3a1232a17b09ce88af40@heytings.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:239834 Archived-At: On 15.08.2022 22:36, Gregory Heytings wrote: > >> >> No, I want a simple variable that just gives the size of the narrowed >> region, with nil meaning don't narrow at all. >> > > FWIW, I strongly object to the addition of such a variable (unless it is > clearly stated that it is added temporarily and should not be used > except for testing purposes). > > Adding such a variable only two weeks after locked narrowing has been > introduced means that modes will have little incentive to adapt to that > stronger constraint, if they can "fix" whatever problems that constraint > might cause by setting that variable to nil in their initialization hooks. I don't think major modes would take advantage of that var. I hope not, at least. > We did not have enough time yet to explore whether and how syntax-ppss > can be improved. If you wanted the development to take this route, it would have really made more sense to hold off on applying the narrowing to fontification-functions, keeping font-lock slow-ish in large files. That would have encouraged direct work on speeding it up. But anyway. Suppose we have some more success with syntax-ppss. Two options: 1) parse-partial-sexp is now faster by 10x. That just means we have 10x larger files to deal with. 2) We have learned to find a "safe position" in some file types, to avoid the full scan from the beginning. It's not hard to implement that for JSON and XML, as long as we can stand _some_ imprecision. But there will remain all other file types for which nobody has written such logic. In both cases we fall back to something. And the preceding discussion has concluded that that something is narrowing.