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.devel Subject: Re: master 544db1e: Faster grep pattern for identifiers Date: Wed, 15 Sep 2021 19:25:25 +0300 Message-ID: <7b0409e3-fc88-b34e-9365-25356bb85859@yandex.ru> References: <83h7elbzo3.fsf@gnu.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="5868"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cc: emacs-devel@gnu.org To: Eli Zaretskii , =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 15 18:26:46 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mQXkE-0001Ix-DW for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 18:26:46 +0200 Original-Received: from localhost ([::1]:54346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXkC-0007eh-Hp for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 12:26:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXj3-0006sC-Qx for emacs-devel@gnu.org; Wed, 15 Sep 2021 12:25:33 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:41897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXj0-0008Pt-Ti; Wed, 15 Sep 2021 12:25:33 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id g19-20020a1c9d13000000b003075062d4daso2484708wme.0; Wed, 15 Sep 2021 09:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xHjTSk4RolOTojHT0BejeQ7vYAPAJA/Eoea/egP661U=; b=GMRrC3w7tHZoC7qTnE0mnfgoj7emkSkdQyp2mPByKXpRhdbBwvx4Ug2imWxWpzcmbV GWahfhEMLI1fnODiMqu67B6zkBp135HQh+L16AdfgVYrPRAKiCusfqB2vthzgSQ54fSK Fz2FtViDVDKFoGEaJZlTwAqsAnmtKa3xZwAyr2ZeFJDv+pr0ix1xD04RIrvUDOyKlVa3 j/DTcV+65W1q66e3LoLYkuAri5DSRniW1o9AeF9f9WNg/+yPL02uXtxsMsM8TUcDeOZX b0vkX55fH+kLwCc1Qdmarc+lTCimUiIPR19AygProYNQMg6qjJLQZ4UA0Lr6eHWNRpBQ PleA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=xHjTSk4RolOTojHT0BejeQ7vYAPAJA/Eoea/egP661U=; b=LYGjAUvznvc3xELH7oER8I9Vi3C813iFTL1PGelS4hx2mPVvVnbErUaJIDArn6+N/c XnpoDha0+DZI4gPMdK9pkquasUAkF6Vo3j3ukriB11s+B/uJRlLG2HvhxZvJC2p2Bu4O LEfcAxPLYS8kNIFlYG3Ci+oPb0MvQv2CUn3yIGUpBi4fzfOSN1W8D6UJDRj0myLBoE9t TX79P1JnB5mqlgbx9UqCSB+cZnIRm2cQ571GrmIKyxdiiOFNrcVmCbIPWK6MFBZ/dWgT k0zNxw0orSariuXB59t6oVsb5AFlihoqxhT/ARRmeRqQo4IA793sjTO0aD3FYszpuw6K P28A== X-Gm-Message-State: AOAM530Nz8E50WF1MmyfWxq118i2doIIOXGEKb8zMhKnMWiS8Gy2JCuN 5csoQM6OoPCmn6OrKLlIbba4Vb1N9FM= X-Google-Smtp-Source: ABdhPJxooEBPonOcFrbY/ZCquhpTtevxwwF9+PoSTMPptf1XYxMa3F9G/Czmv4DA9CzmOsYS0uxzIA== X-Received: by 2002:a05:600c:2259:: with SMTP id a25mr587303wmm.133.1631723128856; Wed, 15 Sep 2021 09:25:28 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id w1sm4754231wmc.19.2021.09.15.09.25.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Sep 2021 09:25:28 -0700 (PDT) In-Reply-To: <83h7elbzo3.fsf@gnu.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=raaahh@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.698, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274751 Archived-At: On 15.09.2021 18:56, Eli Zaretskii wrote: >> branch: master >> commit 544db1ee8679eec9edd5cee81a340ee1c4d70158 >> Author: Mattias Engdegård >> >> Faster grep pattern for identifiers >> >> * lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search): >> Use the `-w` flag instead of wrapping the pattern in regexps that make >> matching much slower. This speeds up `xref-find-references` by about >> 3× on macOS. > Doesn't this change the semantics of the "word"? The Grep notion of > the word is not necessarily identical to that of Emacs, since the > latter depends on the major mode. The comment in the deleted code > says that much, AFAICT. Or what am I missing? Luckily, -w actually corresponds to the regexp which the previous version of the code was using. Rather than to \<...\> which one might surmise from reading the docs for some versions of Grep (or Ripgrep). And the comment was about \< and \>. The latest Grep manual describes it correctly: -w, --word-regexp Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.