From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71094: [PATCH] Prefer to run find and grep in parallel in rgrep Date: Wed, 22 May 2024 21:30:27 +0300 Message-ID: <86r0dt66nw.fsf@gnu.org> References: <86ttiq6or8.fsf@gnu.org> <8aedd0ed-58fe-4ac7-98d6-950be2d4700b@gutov.dev> <868r026jlq.fsf@gnu.org> <861q5t7vrp.fsf@gnu.org> <10f62497-dfb1-4c46-b18a-6d1100de4b6a@gutov.dev> <86wmnl6f62.fsf@gnu.org> <87pltdbu17.fsf@ledu-giraud.fr> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20247"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 71094@debbugs.gnu.org, rgm@gnu.org, sbaugh@janestreet.com To: Manuel Giraud Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 22 20:31:13 2024 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 1s9qk5-00054J-9v for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 May 2024 20:31:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9qjq-0000JW-U8; Wed, 22 May 2024 14:31:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9qjo-0000IJ-Eu for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 14:30:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9qjo-0004KH-4S for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 14:30:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s9qju-0000C3-06 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 14:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 May 2024 18:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71094-submit@debbugs.gnu.org id=B71094.171640264530883 (code B ref 71094); Wed, 22 May 2024 18:31:01 +0000 Original-Received: (at 71094) by debbugs.gnu.org; 22 May 2024 18:30:45 +0000 Original-Received: from localhost ([127.0.0.1]:57503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9qjd-00081E-Bb for submit@debbugs.gnu.org; Wed, 22 May 2024 14:30:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9qjb-0007nh-T0 for 71094@debbugs.gnu.org; Wed, 22 May 2024 14:30:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9qjP-0004IO-CY; Wed, 22 May 2024 14:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JmKZmda7uGbD7hK8vjUUeFudsSpmwHTtNiMvVc/eFnA=; b=eGjkd6/SvCWe uRa0BmavLnlwXGSB7EYkxphGMeumQ5NLGqcmzq7UQXRjVHByhiv+Y7r2PtG3ys28DvGWqhQYUCtVD EmkQ6aBvgZYMb3W2+snR+4XDv8vpsRMy80fO+72EPCgMNynguglgGQDKcWnKk9u1I6i9hVL68SY0P AkylSgqfCtvnOeJVVSCq6m1dG+685NK3dpu3vdQ7Uax1yXfP6NVikkxDrRBMY+mLyDUopT3JslqTK 68kTI0p3Zq60e98o62WSPUxwQVW1SYxqM7EvrsLJxzhdctv16wQPjdqKgkogqYP5xGnulASfN8EpF i24rHGUrEDZXo5lQCBlyaw==; In-Reply-To: <87pltdbu17.fsf@ledu-giraud.fr> (message from Manuel Giraud on Wed, 22 May 2024 20:06:44 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285651 Archived-At: > From: Manuel Giraud > Cc: Dmitry Gutov , sbaugh@janestreet.com, > 71094@debbugs.gnu.org, rgm@gnu.org > Date: Wed, 22 May 2024 20:06:44 +0200 > > Eli Zaretskii writes: > > [...] > > >> >> So here is another example: a Linux kernel checkout (76K files). Also > >> >> about 30% improvement: 1.40s vs 2.00s. > >> > > >> > This is all highly system-dependent. > >> > >> Naturally. So it'd be great to see some additional data points from > >> users on other systems. > >> > >> Especially those where the default limit is lower than it is on mine. > > > > I'd be happy if someone could time these methods on MS-Windows and on > > some *BSD system, at least. Bonus points for macOS. > > I'm not sure it is what you asked for but here is some numbers on > OpenBSD (native 'find' and 'xargs'): > > $ time find ~/emacs-repo -type f -exec grep foo {} + > /dev/null > 0m04.09s real 0m03.29s user 0m00.74s system > $ time find ~/emacs-repo -type f -print0 | xargs -0 grep foo > /dev/null > 0m04.10s real 0m03.45s user 0m00.66s system > > $ find /usr/src -type f | wc -l > 114315 > $ time find /usr/src -type f -exec grep foo {} + > /dev/null > 0m14.07s real 0m07.68s user 0m06.29s system > $ time find /usr/src -type f -print0 | xargs -0 grep foo > /dev/null > 0m13.83s real 0m07.94s user 0m06.25s system Thanks, but we need the timings of the corresponding Emacs commands, not the commands run from the shell prompt. Btw, are you sure that xargs or grep don't pay attention to the fact that their output is redirected to the null device, and do nothing? Some variants of these commands are known to use such a trick, AFAIR.