From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30508 invoked from network); 4 Mar 2023 10:07:24 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 4 Mar 2023 10:07:24 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id C7D554129B; Sat, 4 Mar 2023 20:07:22 +1000 (AEST) Received: from relay05.pair.com (relay05.pair.com [216.92.24.67]) by minnie.tuhs.org (Postfix) with ESMTPS id 41CC641255 for ; Sat, 4 Mar 2023 20:07:19 +1000 (AEST) Received: from orac.inputplus.co.uk (unknown [87.112.122.222]) by relay05.pair.com (Postfix) with ESMTP id 7CE231A275F for ; Sat, 4 Mar 2023 05:07:18 -0500 (EST) Received: from orac.inputplus.co.uk (orac.inputplus.co.uk [IPv6:::1]) by orac.inputplus.co.uk (Postfix) with ESMTP id E8F882021A for ; Sat, 4 Mar 2023 10:07:17 +0000 (GMT) From: Ralph Corderoy To: coff@tuhs.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-reply-to: References: <8d1de5c8-1f34-3d37-395d-0f1da7b062ec@spamtrap.tnetconsulting.net> Date: Sat, 04 Mar 2023 10:07:17 +0000 Message-Id: <20230304100717.E8F882021A@orac.inputplus.co.uk> Message-ID-Hash: ECUD33676QZRMC7CE3GLT7BPHZR4ULSD X-Message-ID-Hash: ECUD33676QZRMC7CE3GLT7BPHZR4ULSD X-MailFrom: ralph@inputplus.co.uk X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [COFF] Re: Requesting thoughts on extended regular expressions in grep. List-Id: Computer Old Farts Forum Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Grant, > Suppose I have the following two lines: > > aaa aaa > aaa bbb > > Does the following RE w/ back-reference introduce a big performance > penalty? > > (aaa|bbb) \1 > > As in: > > % echo "aaa aaa" | egrep "(aaa|bbb) \1" > aaa aaa You could measure the number of CPU instructions and experiment. $ echo xyzaaa aaaxyz >f $ ticks() { LC_ALL=C perf stat -e instructions egrep "$@"; } $ $ ticks '(aaa|bbb) \1'