From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Sun, 07 Aug 2022 00:11:52 +0000 Message-ID: <6ae35c93062c589b2e02@heytings.org> References: <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> <8c7321f2f36494299e61@heytings.org> <83v8rc2n1h.fsf@gnu.org> <64084296-1953-8ef8-5938-adfb6fb9b43f@yandex.ru> <83r11uzs8n.fsf@gnu.org> <14845631-c2ef-8371-8606-c858092e3192@yandex.ru> <83mtcizov2.fsf@gnu.org> <83h72qzheq.fsf@gnu.org> <25717d84-3411-a93a-3620-e04fe0571aff@yandex.ru> <83edxuzemr.fsf@gnu.org> <83a68hzz0a.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 07 02:12:19 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 1oKTtz-0000DG-7M for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 02:12:19 +0200 Original-Received: from localhost ([::1]:44858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKTtx-0004Gj-Qp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 20:12:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKTtr-0004GD-8j for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 20:12:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKTti-0002cK-DX for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 20:12:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKTti-0004AW-89 for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 20:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Aug 2022 00:12: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.165983111616013 (code B ref 56682); Sun, 07 Aug 2022 00:12:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 7 Aug 2022 00:11:56 +0000 Original-Received: from localhost ([127.0.0.1]:35671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKTtb-0004AD-U5 for submit@debbugs.gnu.org; Sat, 06 Aug 2022 20:11:56 -0400 Original-Received: from heytings.org ([95.142.160.155]:42348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKTta-0004A4-En for 56682@debbugs.gnu.org; Sat, 06 Aug 2022 20:11:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659831113; bh=TEJMPS2cxZcfseodAEQxbqWYxEFfAGj8xNTtdR7yS0A=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=zttvyXuuAO0ofGmdbwEspytYG7M5TuXqPXIKj4IHb98pNf4A9VFbIl3JFsVvbRNoA X05EKMBWUWEH0Z+r+Y2RgNVHz5ON+UKZtUb8KcaGP7nn3T56r06W/z08yImI8s4MZ3 Ou4cGByR9IcBDwdiaMGP11qDcH8fH7/ArU0VSQTy8fHZjKgDJHFVsEpyjG3y1fYsUp hGv1jrF0sS0/AoP6dbD2p+4W72JU39jjKPguHM4xkzPOnjd3a5qL3poVjbVucQrSI3 qlI4db50MwcmqwZp+Hx+6F0S6RSz5qfon8F6hAeKNljC5ojUZslBSB+SeGc6uH0mXF iULe7AUAAfJtQ== In-Reply-To: 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:239008 Archived-At: >>> I'm not seeing any particular sluggishness in these operations when >>> visiting dictionary.json. >> >> Numbers, please. You have a very fast machine, so what doesn't look >> sluggish on your system could very well be so on others. > > How do you measure these operations including the redisplay lag? > > Anyway, all of these look instant. > They aren't, no. Of course it all depends on where you are in the file, on your CPU, and so forth. For me (with locked narrowing disabled, in dictionary.json, with emacs -Q) M-> takes about 3 seconds. Likewise, if I do for example C-s aan, and then repeat C-s, whenever the next match is far enough in the buffer I see a delay of about 2 seconds. Another test you can do is to lean on C-v after opening the buffer, you'll see that Emacs becomes very sluggish, sometimes I have to wait more than 5 seconds to avance from one screenfull. > > Correct syntax highlighting requires parsing the buffer from the > beginning. Otherwise we get random results, essentially. > It all depends how you define "correct". You may remind that I suggested to introduce some heuristics in the algorithm. With appropriate heuristics, you could probably get reasonably good results even if you only have access to a small portion of the buffer. For example, instead of counting the number of '"' characters from BOB to know for sure if you are in a string, you mark those that are likely at the beginning of a string and those that are likely at the end of a string, and you select the most likely possibility among all combinations to highlight the buffer portion as well as possible.