From owner-dev-commits-ports-all@freebsd.org Wed Apr 14 12:22:48 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75F8C5D6FE1; Wed, 14 Apr 2021 12:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FL1p00529z3ChL; Wed, 14 Apr 2021 12:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C2A81DE86; Wed, 14 Apr 2021 12:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13ECMlRL064618; Wed, 14 Apr 2021 12:22:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ECMlvp064617; Wed, 14 Apr 2021 12:22:47 GMT (envelope-from git) Date: Wed, 14 Apr 2021 12:22:47 GMT Message-Id: <202104141222.13ECMlvp064617@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Tobias Kortkamp Subject: git: ffd4db6b9406 - main - Speed up USES=cargo ports ops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tobik X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffd4db6b940600e78ab01f8ef06bb3e7629f48e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2021 12:22:48 -0000 The branch main has been updated by tobik: URL: https://cgit.FreeBSD.org/ports/commit/?id=ffd4db6b940600e78ab01f8ef06bb3e7629f48e6 commit ffd4db6b940600e78ab01f8ef06bb3e7629f48e6 Author: Tobias Kortkamp AuthorDate: 2021-04-14 11:53:37 +0000 Commit: Tobias Kortkamp CommitDate: 2021-04-14 12:22:42 +0000 Speed up USES=cargo ports ops MASTER_SITES aliases processing in the framework is very inefficient and the CRATESIO indirection is not worth it. Normally ports only have a handful of sites at most, but USES=cargo currently adds one site for each crate by necessity. The inefficiency suddenly matters a lot. By consuming MASTER_SITE_CRATESIO directly we can sidestep this issue without losing anything. Before: $ time make -C www/zola -V MASTER_SITES >/dev/null 4.21 real 4.14 user 0.03 sys After: $ time make -C www/zola -V MASTER_SITES >/dev/null 0.60 real 0.58 user 0.02 sys --- Mk/Uses/cargo.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index 69a1ee45c8a4..816b720a2eef 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -15,7 +15,7 @@ IGNORE+= USES=cargo takes no arguments .endif # List of static dependencies. The format is cratename-version. -# CARGO_CRATES will be downloaded from MASTER_SITES_CRATESIO. +# CARGO_CRATES will be downloaded from MASTER_SITE_CRATESIO. CARGO_CRATES?= # List of features to build (space separated list). @@ -35,7 +35,8 @@ CARGO_DIST_SUBDIR?= rust/crates # Generate list of DISTFILES. .for _crate in ${CARGO_CRATES} -MASTER_SITES+= CRATESIO/${_crate:C/^([-_a-zA-Z0-9]+)-[0-9].*/\1/}/${_crate:C/^[-_a-zA-Z0-9]+-([0-9].*)/\1/}:cargo_${_crate:C/[^a-zA-Z0-9_]//g} +# Resolving CRATESIO alias is very inefficient with many MASTER_SITES, consume MASTER_SITE_CRATESIO directly +MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_crate:C/^([-_a-zA-Z0-9]+)-[0-9].*/\1/}/${_crate:C/^[-_a-zA-Z0-9]+-([0-9].*)/\1/},:S,$,:cargo_${_crate:C/[^a-zA-Z0-9_]//g},} DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}.tar.gz:cargo_${_crate:C/[^a-zA-Z0-9_]//g} .endfor