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: Thu, 28 Jul 2022 00:38:09 +0300 Message-ID: References: <837d46mjen.fsf@gnu.org> <8335esjppt.fsf@gnu.org> <837d43j198.fsf@gnu.org> <83y1wjhkkh.fsf@gnu.org> <83wnc3hkdg.fsf@gnu.org> <49df74e5-e16a-a532-98d1-66c6ff1eb6c6@yandex.ru> <83pmhuft5a.fsf@gnu.org> <05388e8d8836c2e7ef3e@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="18242"; 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: gerd.moellmann@gmail.com, 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 Wed Jul 27 23:39:32 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 1oGoke-0004YJ-DZ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jul 2022 23:39:32 +0200 Original-Received: from localhost ([::1]:49720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGokc-00011i-1n for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jul 2022 17:39:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGokC-0000zs-5v for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 17:39:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39163) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGokB-00030h-RO for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 17:39:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGokA-00028T-8P for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 17:39: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: Wed, 27 Jul 2022 21:39: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.16589579018152 (code B ref 56682); Wed, 27 Jul 2022 21:39:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 27 Jul 2022 21:38:21 +0000 Original-Received: from localhost ([127.0.0.1]:57145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGojV-00027P-Ap for submit@debbugs.gnu.org; Wed, 27 Jul 2022 17:38:21 -0400 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:38459) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGojS-000273-2D for 56682@debbugs.gnu.org; Wed, 27 Jul 2022 17:38:19 -0400 Original-Received: by mail-wr1-f41.google.com with SMTP id k11so25708179wrx.5 for <56682@debbugs.gnu.org>; Wed, 27 Jul 2022 14:38:18 -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=QS1a7xT0rNikqietnbpvUEgBPezU0uoz1riQLE9yAPI=; b=Y4n6za/ejfnrfCHYstzm3S5gNADuqZ06r+TRU8hNj19hNg3Ze0vnAoB6eFq5BWvZuD QB4ihi8G3KUdynzmblkua7KUeYI5UAFaq0ppHjEPRZjbLx1zyKwvt4YzG99SKrKI1CyO GaPG2gD/TfoFGBpunrPYstMN9Hn8uHOzRvNn797fl22mCm/QaWmR2jcz+FfQXFIt3xzT vOaNmAIfZ8ntkForrEW30HwCIoTfxtHG1wGD/rcn4NYCQljnVT6OqHDS1o7jXVe3eFpH cDJy1DhiksDFiNECTaHY4DdLFJyfx+Ro+P19S9qtLiTKGljTE1Uj6jx8pBWCxHMQ/nxi FRWw== 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=QS1a7xT0rNikqietnbpvUEgBPezU0uoz1riQLE9yAPI=; b=p5Va5RbyGaI29ixFTKMBOyS5ZYYtyPLvR+6xO9JSDtP0g6Gh0OJK48GSJRfeqo/hNJ RzfZzBx3FFyrBs/EHil+8d8vCJDgb1Aa2BKPdC1/c+z2hLmEMQgLo6DAVIbaEceDwm+c n5GSvBMxhCioPvdg1o28YR3gKIrAEy/zYGA4bMTEWFnK5El++ViM8HH4Ptr7mQff+CXS PRW1Uuu3BtBtoUgeHj5T7EF+G3M3sAKxlp8RTi+RdxW5Jy0vRgXh2X/+Y6SEtdHZKzIl 3v/eUZnOZ6TY5hFjmRQ5MVI9A++d4DGda93RmtU/7rus4hWAK5JclaPOLeK/+wErQFSw Y1GA== X-Gm-Message-State: AJIora9R/T5op4mK/3Prh2RX5D7Pg/fkrxqgc8ZlSLYTK6R+Z9KrxZwk leIVrl+i/4YWlvi2UjghK90= X-Google-Smtp-Source: AGRyM1ve3k/E/2gifF1lKVwJMEtGEVZifW2+aw/H3dRi0QLJGSP04NaGtW2bSKdoY+hsYkGW7dy/6Q== X-Received: by 2002:adf:e78a:0:b0:21e:8cf2:f115 with SMTP id n10-20020adfe78a000000b0021e8cf2f115mr10460060wrm.344.1658957891147; Wed, 27 Jul 2022 14:38:11 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id h6-20020a05600c350600b003a38606385esm98687wmq.3.2022.07.27.14.38.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jul 2022 14:38:10 -0700 (PDT) Content-Language: en-US In-Reply-To: <05388e8d8836c2e7ef3e@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:238063 Archived-At: On 27.07.2022 09:55, Gregory Heytings wrote: > >> >> But I'm seeing incorrect fontification. Is this one expected? >> > > Yes, occasional mis-fontification is expected.  It's a compromise > between "no fontification" and "slow fontification". I wonder now if the majority of the slowdown was caused by the redisplay, whereas font-lock (which only has to run once per screenful) was actually "fast enough". >> Perhaps something to do with the number 40000? >> > > There is no magical number 40000 in the implementation, the buffer > limits to which fontification-functions are constrained are determined > dynamically, depending on the width and height of the window. > > My guess in this specific case is that the first instance of > "Downloadify.Container" was fontified by the previous call to > fontification-functions, and that the next chunk of text in which the > two other instances of "Downloadify.Container" are contained was > fontified by the next call to fontification-functions, which did not > have access anymore to the place where Downloadify.Container is defined. Could you clarify what you mean by "access ... to the place where ... is defined"? "new Downloadify.Container" is highlighted by a regular regexp matcher, not some custom elisp code which has to visit the position where the identifier is defined. Same goes for the tokens like "null", "function" and "return", but those do get fontified after position 40000 in this example. And the way those rules get applied doesn't seem particularly different, it's just that the keyword matcher goes before the class instantiation matcher inside js--font-lock-keywords-3.