From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#44983: Truncate long lines of grep output Date: Wed, 02 Dec 2020 11:35:38 +0200 Organization: LINKOV.NET Message-ID: <87h7p4r1n9.fsf@mail.linkov.net> References: <87v9dlc3ti.fsf_-_@mail.linkov.net> <83ft4pik35.fsf@gnu.org> <87sg8p5kw0.fsf@mail.linkov.net> <83eek8hoyx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23909"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 44983@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 02 11:54:05 2020 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 1kkPlp-00061V-J9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Dec 2020 11:54:01 +0100 Original-Received: from localhost ([::1]:58790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkPlo-0002IO-KA for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Dec 2020 05:54:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkOcL-00068f-Ky for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 04:40:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkOcE-0007d0-BW for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 04:40:09 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkOcE-0001gA-8f for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 04:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Dec 2020 09:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44983 X-GNU-PR-Package: emacs Original-Received: via spool by 44983-submit@debbugs.gnu.org id=B44983.16069019676399 (code B ref 44983); Wed, 02 Dec 2020 09:40:02 +0000 Original-Received: (at 44983) by debbugs.gnu.org; 2 Dec 2020 09:39:27 +0000 Original-Received: from localhost ([127.0.0.1]:34246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkObf-0001f8-4C for submit@debbugs.gnu.org; Wed, 02 Dec 2020 04:39:27 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:43657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkObb-0001ed-0O for 44983@debbugs.gnu.org; Wed, 02 Dec 2020 04:39:25 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 50E3C1BF207; Wed, 2 Dec 2020 09:39:14 +0000 (UTC) In-Reply-To: <83eek8hoyx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 02 Dec 2020 05:21:58 +0200") 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:194780 Archived-At: >> It's very strange that after adding the text property 'display "[…]" >> on a very long line, motion commands are still very slow in that buffer. >> >> Could you help to understand why hiding long regions >> doesn't help to improve performance? > > I can try, but please tell which commands are slow. Is it C-f/C-b, > C-n/C-p, C-v/M-v, something else? Hmm, something strange is going on. After inserting million-char lines: (dotimes (_ 10) (insert (propertize (make-string 1000000 ?a) 'display "[…]" 'invisible t) "\n")) No problem, everything is still fast, C-f/C-b, C-n/C-p, C-v/M-v move fast. After saving to a file, grep on this file is fast with the previous patch that hides long lines. However, when grepping on minified web assets files where all styles and scripts are on one long line, then output becomes slower and slower as the line inserted by the grep process filter grows longer. It works this way: compilation-filter/grep-filter inserts the next chunk of the long line, then font-lock applies the rule from the previous patch that hides the inserted substring starting from the fixed position from the beginning of the line until the end of the line, and repeats the same for every new inserted chunk of the long line. Maybe instead of using font-lock to hide long parts of grep lines, it would be better to do the same directly in compilation-filter/grep-filter? Or maybe the problem is caused by special characters used in minified web assets that contain many '{' chars. And indeed, after inserting 100 thousands of '{' (insert (propertize (make-string 100000 ?{) 'display "[…]" 'invisible t) "\n") and saving to a file, later visiting such file Emacs becomes unresponsive for indefinite time. But visiting the file with 100 thousands '{' with find-file-literally causes no such problem.