From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 664F7A15D; Wed, 10 Sep 2025 20:04:33 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id B6AEAA0CC; Wed, 10 Sep 2025 20:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) by atuin.qyliss.net (Postfix) with ESMTPS id DE125A0C8 for ; Wed, 10 Sep 2025 20:04:28 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 29189EC032C; Wed, 10 Sep 2025 16:04:27 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 10 Sep 2025 16:04:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1757534667; x=1757621067; bh=A/xoRxKL0Q Pfli12uEAVT/fZCnm6xENjT9AKH2lfw0g=; b=BYyq+ljS7yCtCDsV7iBGrdzmFw jwgw1H+TjLPgKMDwz9VtrbA5vmhBXPTxIOv+ibgfF9f1OewwecLt5VHhUdbETUgC /xhyLFflIMKhSfGGhBHvmCJY/ZGkFqgWL96BWo6q8fk6NhBTh2kWovrFEcdHjWJ+ 6j+rucbmhT2MZ+g0UZ58tYmCHDcluENaV2Bjz7w//oyh3LuRQGrie6kF3JrsTV7c XYtqB+IjiTyGSPAsfq9Bcr55iSt+BIKWpFYJyDtmEK5Ibd9bdjmwAVY4Zh9Nw+Ze 0DvjRtwM0lxi4rRWCrwwnTxUY7wme6vP0nTnVx0/UKnheo3ZtSndqMK7p6zA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1757534667; x=1757621067; bh=A/xoRxKL0QPfli12uEAVT/fZCnm6xENjT9A KH2lfw0g=; b=f6GqrVskBhX8qSIihKVrSPk33y+ZSfL5KcVBzpxMoGz1MMiiuSD OCMXNmhIWieUFV8rH4v/aRJARCO3b18k+VPZDPvU0PZPj0kVcPZ3n3rZWiYCHK+k TJG3l0sQwY0ZCqKZVZOwWOAMarwRoYFuUByXJW0syLcbfPiYv1EllezsUwZCZmrJ KWjKXTEXzhcUVSQnEGGAIBveetaYzsLgw4tc57VmCEgNuhYfFZ855oLjbhOtQcMp xjsqH3f/xm8nzyc2tiZhXsvEalGanY/iDPRtz5g1LwAMje5ajC7OOONLm1q3eyti vtShNBTqYYMEBVWW+zZ34+1iYITij9tUHKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvgedvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddtjeenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepteehvedugf ejgfehhfeijeduleekleejgedvkeeuuefhhfegvdevfeetveegteeinecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Sep 2025 16:04:26 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 679421DE22C4; Wed, 10 Sep 2025 22:04:15 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH 05/20] scripts/make-erofs.sh: Avoid unneeded calls to dirname In-Reply-To: <20250904-systemd-v1-5-2a63b790a913@gmail.com> References: <20250904-systemd-v1-0-2a63b790a913@gmail.com> <20250904-systemd-v1-5-2a63b790a913@gmail.com> Date: Wed, 10 Sep 2025 22:04:12 +0200 Message-ID: <87cy7yulab.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: J2FUQXSAMTZZO3FEVR2XG5WTT24SXQ5N X-Message-ID-Hash: J2FUQXSAMTZZO3FEVR2XG5WTT24SXQ5N X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > Use builtin string manipulation instead. > > Signed-off-by: Demi Marie Obenour > --- > scripts/make-erofs.sh | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh > index cf942972910c76e1835dc5b0084c2d04bf084a9d..93cb3245f409b24c24be05e93= 07a1b2e12c867fe 100755 > --- a/scripts/make-erofs.sh > +++ b/scripts/make-erofs.sh > @@ -78,7 +78,19 @@ while read -r arg1; do >=20=20 > check_path "$arg1" "$arg2" >=20=20 > - parent=3D$(dirname "$arg2") > + # The below simple version of dirname(1) can only handle > + # a subset of all paths, but this subset includes all of > + # the paths that check_path doesn't reject. > + case $arg2 in > + (*/*) > + # Create the parent directory if it doesn't already > + # exist. > + parent=3D${arg2%/*} > + ;; > + (*) > + parent=3D. > + ;; > + esac > mkdir -p -- "$root/$parent" > cp -RT -- "$arg1" "$root/$arg2" > done Saves about 600ms for me, and the improvement is just outside the margin of error. What do we think? Worth it? (6aab79a is with patches 1=E2=80=933 from this series applied; 7cc01b6 is patches 1=E2=80=935.) % hyperfine -w 1 -L commit 6aab79a,7cc01b6 --prepare 'git checkout {commit}= && make clean && make build/etc/s6-rc' 'make' Benchmark 1: make (commit =3D 6aab79a) Time (mean =C2=B1 =CF=83): 13.205 s =C2=B1 0.282 s [User: 2.007 s= , System: 6.397 s] Range (min =E2=80=A6 max): 12.934 s =E2=80=A6 13.698 s 10 runs =20 Benchmark 2: make (commit =3D 7cc01b6) Time (mean =C2=B1 =CF=83): 12.662 s =C2=B1 0.290 s [User: 1.675 s= , System: 6.151 s] Range (min =E2=80=A6 max): 12.371 s =E2=80=A6 13.127 s 10 runs =20 Summary make (commit =3D 7cc01b6) ran 1.04 =C2=B1 0.03 times faster than make (commit =3D 6aab79a) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaMHZvAAKCRBbRZGEIw/w oobyAQDAtGaoxpHo1N4M7Lt/RlhToY0oq+gX4NuAkBAY/pvD0QEAkm1lGycYWN3U F0cGTtqDKW/6DxiOLbgkYA3tfIWFywM= =2cBP -----END PGP SIGNATURE----- --=-=-=--