From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#46859: 28.0.50; [PATCH]: Add option to truncate long lines in xref.el Date: Sun, 07 Mar 2021 21:03:09 +0100 Message-ID: References: <87im69uzlt.fsf@mail.linkov.net> <25782781-4baa-5d44-99a1-2e57552ab3a0@yandex.ru> <666564dc-0252-6bf5-04e1-58c9916cffbe@yandex.ru> <92f18de5-6dae-8041-2da0-e4b782f9003e@yandex.ru> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13469"; mail-complaints-to="usenet@ciao.gmane.io" To: Dmitry Gutov , juri@linkov.net, 46859@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 21:04:14 2021 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 1lIzdN-0003La-9v for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 21:04:13 +0100 Original-Received: from localhost ([::1]:38468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIzdM-0007OA-80 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 15:04:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIzdC-0007Mj-EH for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:04:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIzdC-0000i5-6m for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIzdC-0007MD-2X for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Mar 2021 20:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46859 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46859-submit@debbugs.gnu.org id=B46859.161514739728226 (code B ref 46859); Sun, 07 Mar 2021 20:04:02 +0000 Original-Received: (at 46859) by debbugs.gnu.org; 7 Mar 2021 20:03:17 +0000 Original-Received: from localhost ([127.0.0.1]:41564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIzcS-0007LC-SH for submit@debbugs.gnu.org; Sun, 07 Mar 2021 15:03:17 -0500 Original-Received: from out1.migadu.com ([91.121.223.63]:23196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIzcO-0007L1-Vz for 46859@debbugs.gnu.org; Sun, 07 Mar 2021 15:03:15 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1615147391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YBX+2mt3H5LDh9Jd36NvDkDYHAlit5nL45OAIk21qAU=; b=c3Q2oNWT78Jr8agXHS15EvKLTjwGQU1FqYyfjk0aEyudB/xZe+eP/5XRQZUX5SUCVWCFY4 5lMaCN2lnGYnnxMEejv3jGGuc3+2pGy8Ekjeh81erjYisWqEmthQfwRmlYgRfxkvgo7Xw8 F4buzjWr/QA0AVMI8ImC1v1LLmwrVuMeVUnP3pFySlECohh1bhh9LGXdgO6yM6K06c0aK0 X0wTUn6zDtlaq9s4/Dq5pZdBdqpVEnnc1p/wRc9jRlLlqTpyXaORHtKHX+MVVAaSKdQUZO 4x5sFvefx7d/Lc3H9Ewa6T/hcdxIhPYoZCRlVfQo1gGrElYBCJMLuiqVc6m1bQ== In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: theo@thornhill.no 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:201771 Archived-At: Hi! > > Please try out the attached preparation patch. > > It improves the performance of the "very long line" case drastically > over here, while not doing any truncation yet. Looks like we regressed > that case when we added rendering of multiple matches on the same line. > Yes, this seems to help a lot. Now the search is down from 11 seconds to 1.09. It is comparable to the other good efforts. > We can add the truncation feature on top of it. I think we should, since moving around in the xref-buffer is still very slow. > > Probably also in xref--collect-matches-1 (truncating the value of > SUMMARY just before the xref-make-match call). > > Alternatively, we could experiment with hiding parts of the long line > using some display/visibility features (except the truncate-lines > variable, that one keeps things slow). That could be done in > xref--insert-xrefs or somewhere nearby. That is trickier, though, given > that we'll probably want to unhide it (wholly or partially) when > iterating over matches inside. At this point I'm really thinking that truncating without bothering too much about losing information is worth it, and the added complexity by retaining information would only make regressions more feasible. I assume these files are _actually_ read once every blue moon. To maximize the speedup should be at a higher priority than retaining the matches, IMO. In any case, if there is a hit on one of these long lines, the current efforts will render them as results to the xref buffer. Searching or editing these files wouldn't be emacs' strength anyways :) My proposal for the "best" fix would be: - truncating long lines by default, both for grep and ripgrep - adding some variation of the "-M " value for ripgrep by default What do you think? -- Theo