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, 1 Aug 2022 01:42:24 +0300 Message-ID: <2f7eeea3-6ba9-d2c2-1fb9-dd40d2de2002@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> <6ea376f6-d503-06d8-6d83-50c52b695394@yandex.ru> <8c7321f2f3ac52bfee4b@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28258"; 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, Eli Zaretskii , Stefan Monnier To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 01 00:43:11 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 1oIHeR-0007Cv-1B for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 00:43:11 +0200 Original-Received: from localhost ([::1]:58714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIHeQ-0006tI-1X for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 18:43:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIHeI-0006tA-Uc for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIHeI-0002Q6-Hk for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIHeI-0007oe-BE for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:43: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: Sun, 31 Jul 2022 22:43: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.165930735630010 (code B ref 56682); Sun, 31 Jul 2022 22:43:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 22:42:36 +0000 Original-Received: from localhost ([127.0.0.1]:38768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIHdr-0007ny-Pk for submit@debbugs.gnu.org; Sun, 31 Jul 2022 18:42:36 -0400 Original-Received: from mail-wr1-f54.google.com ([209.85.221.54]:44021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIHdq-0007nl-Bj for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 18:42:34 -0400 Original-Received: by mail-wr1-f54.google.com with SMTP id bk11so2196004wrb.10 for <56682@debbugs.gnu.org>; Sun, 31 Jul 2022 15:42:34 -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=rnyCtiz2fYpYTqpd1c97QJNija2jPvUTKvf2fK7/m/o=; b=ZsV1dHG+5yBeLA2zdctXF1ilBc/7moA5EMMCOxgBKHpu0a009cEO00hwzy3kwChD37 xtojwr7H+Swxf1ghogfOOWi3dcQ6LRF4kbXKymRJpEnmIATzmHi62wdt9BwFt4VWNTF0 RKAfIO5GeqHOkwmReTARdkXdo6FAp+yU477dkjtndLhZCLZH69Lfh8DvqqaB7HLLX0/8 2aSZ1EeA1riSDtsLrT/5jsb8Xmc5u1yA3gHRVZEJgEZpKoqWOPM+dZuNgV0g0h/dIA/R gN8HmxE+CIJD6vt8UHonliFw5jjsv+0pnG6PPOmbab7KNFXEYQUjIDgAOLzt3AwapYAz J3tg== 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=rnyCtiz2fYpYTqpd1c97QJNija2jPvUTKvf2fK7/m/o=; b=c8lze2ABTegBDdW8yKMUVY8m166ITuokP6OsQFeKRx3yEEwUyKOe2jjr3QAO3kNPlP UmqLSYPZ5Z3LVcVmeTvuNJBHlSTMVYcvR81ibVENAxHTmmed72FgTl0aS2/OYcxU/nQQ ezq+qRSvWevhGYvYL7tazbP5vfTZL+Rl1b/820tmAU/KqWqyVZzXZdNuqN2qbov+HmEf rn6pEJAoSqwvGc0YjaeFpb2ZzBcb3FnOvC6nEQ6Qz0RjGPzm+Auc4zn89LDoMYCNH6H5 vqXpklZ6nJY8yDXIOT4XF5nv3EgpzpFwjLFlxia3x4GVBh16r9lA6xmqzwJVsSC2P6Fd doDQ== X-Gm-Message-State: ACgBeo0CaUo6pEx9i5qhbLpPkdgfC2zL2t0f4JEnRC7rUhhoswDuZPAf +lG1tzmnBr5rEHGbLD36Gv8= X-Google-Smtp-Source: AA6agR7yXmQvZ7m7YyeXkAiwSMxrDP7qdLxW+85A06xG4DKsY4sL5n36klS+XE/aLQe6/QI9N12dMA== X-Received: by 2002:adf:db8f:0:b0:220:6059:5284 with SMTP id u15-20020adfdb8f000000b0022060595284mr2608340wri.33.1659307348434; Sun, 31 Jul 2022 15:42:28 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j5-20020a05600c1c0500b003a317ee3036sm14322939wms.2.2022.07.31.15.42.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Jul 2022 15:42:27 -0700 (PDT) Content-Language: en-US In-Reply-To: <8c7321f2f3ac52bfee4b@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:238371 Archived-At: On 01.08.2022 01:23, Gregory Heytings wrote: > >>> Yes, I wasn't clear enough, I should have written "when the file is >>> large enough (say 1 GB), even without long lines". >> >> What kind of scenario are you thinking of that would exhibit this >> slowness in a 1 GB file? >> >> If we're talking about syntax-ppss only, regular editing operations >> (typing and deleting code) limited to, say, one screen should trigger >> only a rescan of a limited area inside such buffer. >> > > That's true, but with such big files, the initial scan is slow.  So the > scenario is simple: you open a big enough file, type M->, and C-p.  M-> > will be instantaneous, and C-p will take a while, because of syntax-ppss. Yeah, ok. If you are going to visit EOB, a single full scan seems unavoidable. I don't think 'M->' should be instantaneous, though: to display the last page, you need to fontify it, and font-lock depends on syntax-ppss. But one big slow scan (and how slow it is actually depends on a particular major mode) followed by responsive editing sounds much better than what we've had before. So I would recommend against trying to solve this part right now. And yes, some faster approximations of syntax-propertize-rules are possible, especially if we ask individual language modes to provide "simpler" syntax rules.