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#46859: 28.0.50; [PATCH]: Add option to truncate long lines in xref.el Date: Sun, 7 Mar 2021 01:00:39 +0200 Message-ID: References: <4119ea3055ef8f306fc0@heytings.org> <4119ea30557ef84ca190@heytings.org> <7eb7ee0f-7dba-c90d-cb58-af42c3828643@yandex.ru> <4119ea30554b406efbbf@heytings.org> <4119ea30558f1e4145b0@heytings.org> <4119ea30555e80bdcf7e@heytings.org> <1c82e582-8b90-f3c5-5391-1e88ca4e7ab2@yandex.ru> <4119ea30553e3f90ab8c@heytings.org> <87y2f42ex5.fsf@mail.linkov.net> <4119ea30552873ab9870@heytings.org> <83eegvk2u0.fsf@gnu.org> <9cff0f8894658f3b50c8@heytings.org> <83y2f3huz2.fsf@gnu.org> <9cff0f88942d4103c685@heytings.org> <83mtvjhrzj.fsf@gnu.org> <9cff0f889435d8d03313@heytings.org> <834khq266r.fsf@gnu.org> <9cff0f8894ab45713d12@heytings.org> <16ac41d4-5718-0cec-a68b-4abcc736ee4a@yandex.ru> <109276c6-30fb-b1ca-cafa-48a15710099b@yandex.ru> <7de1aeec520f4204be5b@heytings.org> <7de1aeec52841199faed@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="36889"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 46859@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 00:01:11 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 1lIfv4-0009Tb-Qg for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 00:01:10 +0100 Original-Received: from localhost ([::1]:33638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIfv3-0007ZC-Fg for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 18:01:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIfuw-0007Yj-JT for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 18:01:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIfuw-0004dp-CJ for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 18:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIfuw-0004uQ-BS for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 18:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Mar 2021 23:01: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.161507164918844 (code B ref 46859); Sat, 06 Mar 2021 23:01:02 +0000 Original-Received: (at 46859) by debbugs.gnu.org; 6 Mar 2021 23:00:49 +0000 Original-Received: from localhost ([127.0.0.1]:38515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIfuj-0004ts-Gx for submit@debbugs.gnu.org; Sat, 06 Mar 2021 18:00:49 -0500 Original-Received: from mail-ed1-f46.google.com ([209.85.208.46]:39580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIfuh-0004tf-L9 for 46859@debbugs.gnu.org; Sat, 06 Mar 2021 18:00:48 -0500 Original-Received: by mail-ed1-f46.google.com with SMTP id h10so8835920edl.6 for <46859@debbugs.gnu.org>; Sat, 06 Mar 2021 15:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Pwtb4x89wpQxThhU3dsA0L+p6IDfP1cStyeM057OFYQ=; b=lIJbso604WPXlyc+JtfOcA+oqedMiE/+K+gcOzEx0mmgMA3Ecympj9lkth8cIeHvTv ieUTgPbvgnojN1P8e5ryItUXLFrcJzQTl9YvmXx8Vz8bIj3/JFmcWoM0LVu9k58evSWc 9NwL+CYAgh19xE+3NWKnvAa3TW1sGQmQLoUf0hE8xkSFIig6QtQFX0rpOymDBu4riXej 5Bssl2fk720J/rL1//cpw4URugoI7itgBQJIhPAIJ0rsqj7yPvznmatCQY0V/8gxqBoe B9hDDtT2UtEgS4UkKrxgLD2Iatx9oiZXIVauDRqCGsu5GJSdC8XUqBc9YA+wzh/PGgUm 7nEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Pwtb4x89wpQxThhU3dsA0L+p6IDfP1cStyeM057OFYQ=; b=FckIc4GDc1G/E1XWbjrr9wt3kZW2NCsiAXsOoBJO931ShqHgmtKLL+XgyzWokk8Q2Z +PsFqcKFjt8mSmkOE1SovXlZpILhYP3bs+aSM9oQ8LEEPbI6Hs3HA3xbp3uAhASv1pb7 DU9H+ZP4XK7ivRNvmXHLKFQZFMBKOipTS5hrraJXIBdLcpYEPAaHQEah3mtpVWy7s546 4Yvh26TDtAmRgWJyS4ozIL2x8LyP2l10aup+ewRUZTQAd74GCO0Z99fIslgsp6/wZKhp /vwCPdWRqx6VHQrvBhZ1YZWiBjWETJGwUUQd4lFr8k+bECNFu+Ajs2pPA1bvbHahlTAs s9MA== X-Gm-Message-State: AOAM533YBq/ReNsG75CMucRl2rVDMEbj95sIK0DKKI+7I84nGd7IMCAE s+o1naMm6JXXJr1F4j84guHkKAHAjOI= X-Google-Smtp-Source: ABdhPJzbfjNGsGaECE/P8pCQTX2zTu66hJ3OR03ywjyyBZrcaX+wNDc92cDW7/MrkcAcIZpl9Gh5jw== X-Received: by 2002:a05:6402:3487:: with SMTP id v7mr2203270edc.302.1615071641656; Sat, 06 Mar 2021 15:00:41 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f22sm4013138eje.34.2021.03.06.15.00.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Mar 2021 15:00:41 -0800 (PST) In-Reply-To: <7de1aeec52841199faed@heytings.org> Content-Language: en-US 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:201697 Archived-At: Hi Gregory, On 07.03.2021 00:47, Gregory Heytings wrote: > I just did a number of timing tests.  The timings were done in a shell, > on a fresh clone of the Emacs repository, which contains ~5000 files, > and in which one searches for the 43 occurrences of "expose_frame". > > The timings are (in seconds): > > with GNU grep (version 3.6): > > 0.124 | "find  -name '.?*' -prune -o -type f -print | xargs grep -i > -snHE expose_frame" > 0.178 | "find  -name '.?*' -prune -o -type f -print | xargs grep -i > -snobHE '.{0,50}expose_frame.{0,50}'" > 0.253 | "find  -name '.?*' -prune -o -type f -print | xargs grep -i > -snobHE '.{0,80}expose_frame.{0,80}'" > 0.325 | "find  -name '.?*' -prune -o -type f -print | xargs grep -i > -snobHE '.{0,100}expose_frame.{0,100}'" > > with ripgrep (version 12.1.1): > > 0.045 | "find  -name '.?*' -prune -o -type f -print | xargs rg -i -nH > --no-messages expose_frame" > 0.079 | "find  -name '.?*' -prune -o -type f -print | xargs rg -i -nobH > --no-messages '.{0,50}expose_frame.{0,50}'" > 0.109 | "find  -name '.?*' -prune -o -type f -print | xargs rg -i -nobH > --no-messages '.{0,80}expose_frame.{0,80}'" > 0.113 | "find  -name '.?*' -prune -o -type f -print | xargs rg -i -nobH > --no-messages '.{0,100}expose_frame.{0,100}'" > > It seems that a reasonable compromise is a context of 80 characters, > which is only two times slower than a string search with both GNU grep > and ripgrep, and still very fast. 'find' is rarely the fastest way to list all the files in the project. Have you timed it alone? 'git ls-files' is usually much faster, and that's what 'project-files' uses under the covers. So if you redo your test with 'project-find-regexp' as I suggested, you might discover a different slowdown multiplier. > (FTR, I also compared these performances with ack, ag and git grep.  To > my surprise, they are much slower: ack is about three times slower than > GNU grep on a string search, ag is a bit slower than GNU grep on string > searches but much much slower on regexp searches, and git grep is a bit > faster than ripgrep (and GNU grep) on string searches but again much > much slower on regexp searches.) ripgrep is generally the best all-arounder these days, though it might be slower in certain odd cases. 'git grep' is not a real option because it uses Git's list of tracked files directly, and we can't really do that. And that skews the comparisons.