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 05:03:39 +0300 Message-ID: <100d08b3-c25b-683f-6def-39052107ab59@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> 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="19193"; 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 , monnier@iro.umontreal.ca To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 05 04:04:25 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 1oJmhN-0004pj-QF for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Aug 2022 04:04:25 +0200 Original-Received: from localhost ([::1]:33458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJmhM-00032J-Kh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Aug 2022 22:04:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJmh2-00030g-20 for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 22:04:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJmh0-0004yQ-Hr for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 22:04:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJmh0-0005wE-Bn for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 22:04: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 02:04: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.165966503022808 (code B ref 56682); Fri, 05 Aug 2022 02:04:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 5 Aug 2022 02:03:50 +0000 Original-Received: from localhost ([127.0.0.1]:55499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJmgo-0005vo-9J for submit@debbugs.gnu.org; Thu, 04 Aug 2022 22:03:50 -0400 Original-Received: from mail-wm1-f51.google.com ([209.85.128.51]:35654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJmgk-0005vY-PH for 56682@debbugs.gnu.org; Thu, 04 Aug 2022 22:03:48 -0400 Original-Received: by mail-wm1-f51.google.com with SMTP id v131-20020a1cac89000000b003a4bb3f786bso3336792wme.0 for <56682@debbugs.gnu.org>; Thu, 04 Aug 2022 19:03:46 -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=JrSqsB5J8X940P+I/jbz540Rdkbb7+GzGL2cl2GL7lI=; b=Z36oxSrsQFVCkH37MqkQV5pFT7UunUjHvbIn6etneaILNMQsDQCKNzyqAW5zBs51sA 2jChGgNKIjWkCSqfVsDVPz7u6cudEXoidWS+8Zf1Wids7AnIQW4UMl3aaSFq8AsI/cBG M4efH0taT54XFz4YsZ1NLtgMoV3nw0J2WoMBcyj78pg47RHiXRtZpfFc4nTuLv6Eeggr Jjjr2KUM7V/yXztFLoQEO3zVxnobHhaSttx61/uVcAU4/u8CtXEwhXM+1ISSzCfC4JOR uU4w3XVyMPhEW8V4XFp8kumQ+XIzkaqte6JuYY6zkBYz2Jy74VTEwXx2Vt+9tNtmUZdc kKOw== 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=JrSqsB5J8X940P+I/jbz540Rdkbb7+GzGL2cl2GL7lI=; b=ofHBc9l39TU52oceQ9IOV98B4Dhb/7cnmsIgJDPmZdL3H4za7Jqp9324nzAPtyBD78 lfbp2fksfSCOLCru7KLRg56KbyEUlk7w//MNwvF2HG90nwkdb+XFZ6WWcckIV9KV0rch c0UksKVD2vTmmft/TIYVu2F03rQglpXjKos3uLf0YxZwUv/cAp9Ym7FFYVkTDXDL34H4 9hpjBAZ2nE9sdlK6+9ZfQJuRqQhXIvV/NA6NgmBMAKOVUt9EX5s5yqg1PGnJOZGAn2by C+jn54UveJ+DaWfn9cozrOz39aJfKNA9TdFrnIVrDxDxhdWBHTgf+MqVJHZmba0sOm2d YGig== X-Gm-Message-State: ACgBeo19v0Rrac+nAO/N9iFJ/Lcf8Ow5OPFTYrDaThdGJBEgHhoLn5DE dXayQmiLs0ejhZOZAiEQeCo= X-Google-Smtp-Source: AA6agR7eFkZMaY1UF0J+qFJA7g/zxQ5bIRwfCcFNjWMctwkvCJ0F7fHYWTJALzjiWWpR2cNMoZ7SAw== X-Received: by 2002:a1c:2985:0:b0:3a5:15d6:f71e with SMTP id p127-20020a1c2985000000b003a515d6f71emr2245113wmp.119.1659665020804; Thu, 04 Aug 2022 19:03:40 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u11-20020adfeb4b000000b0021f15514e7fsm3013465wrn.0.2022.08.04.19.03.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Aug 2022 19:03:40 -0700 (PDT) Content-Language: en-US In-Reply-To: <74ddc877f17a06d8f120@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:238809 Archived-At: On 02.08.2022 17:57, Gregory Heytings wrote: > >> >> Regarding the long-standing bug reports, we did solve a bunch of >> issues already. One major one, IIUC, was redisplay of already >> fontified text on long lines. >> > > Try to open the dictionary.json with Emacs on master a month ago.  It's > a small file (only 18 MB).  On my computer just opening the file with > emacs -Q takes 220 seconds.  220 seconds during which Emacs is > completely locked, because of font-lock mode.  If you're not convinced, > turn font-lock mode off, open the file, and turn font-lock mode on. I downloaded that file, and I commented out the code in 'handle_fontified_prop' which performs the narrowing on master. And recompiled, leaving all the other settings the same. Visiting dictionary.json takes about 1 second. M-> takes ~2 seconds, but only the first time (and until the next modification near the beginning of the buffer, I guess). Scrolling is as fast as without my change. All fontification seems correct (which is not the case on master). >> Another piece of the puzzle was added by Stefan in 15b2138719b340. >> > > That looked promising, but sadly it had only a very limited effect. > >> >> So perhaps we should re-evaluate the testing scenario to see where the >> current bottlenecks are. If we current main issue is the 55s spent in >> syntax-ppss, a more constructive approach would be to look into >> optimizing parse-partial-sexp. Or even give up on certain scenarios, >> admitting that waiting 55s once to visit the end of a 1 GB buffer is >> not so bad (and that could part could also be sped up by setting >> syntax-propertize-function to nil and using a very simple syntax >> table, for instance). >> > > It is bad, especially now that it became clear that in fact it's not > "waiting 55s once" but "waiting 55s each time the buffer is modified and > you move to another position in the buffer". 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. A separate threshold for syntax-ppss to avoid parsing the whole buffer might fit the bill.