From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 84CEC158008 for ; Thu, 15 Jun 2023 21:14:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BD248E099F; Thu, 15 Jun 2023 21:14:26 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A0DA1E099F for ; Thu, 15 Jun 2023 21:14:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D69C0340E37 for ; Thu, 15 Jun 2023 21:14:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3DD38A96 for ; Thu, 15 Jun 2023 21:14:24 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686863537.48a0a44098b5cdfbceaf37305b7e9eac65748cd0.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/ruby-ng.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 48a0a44098b5cdfbceaf37305b7e9eac65748cd0 X-VCS-Branch: master Date: Thu, 15 Jun 2023 21:14:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4d3d9b14-9b0c-4be8-b9f8-e185b738f32a X-Archives-Hash: db2615620366652bdcf6147f910728b7 commit: 48a0a44098b5cdfbceaf37305b7e9eac65748cd0 Author: Sam James gentoo org> AuthorDate: Tue Jun 13 22:01:11 2023 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jun 15 21:12:17 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48a0a440 ruby-ng.eclass: optimize: avoid subshells for ruby_implementations_depend, ruby_get_use_targets We go from 2.5s -> 1.9s to source dev-ruby/*. Bug: https://bugs.gentoo.org/908465 Signed-off-by: Sam James gentoo.org> eclass/ruby-ng.eclass | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index cf66fcec2f05..6c5666ddeabb 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -325,9 +325,20 @@ ruby_get_use_implementations() { ruby_get_use_targets() { debug-print-function ${FUNCNAME} "${@}" - _ruby_get_all_impls + _ruby_get_use_targets + echo "${_RUBY_GET_USE_TARGETS}" +} + +# @FUNCTION: _ruby_get_use_targets +# @INTERNAL +# @DESCRIPTION: +# Gets an array of ruby use targets that the ebuild sets +_RUBY_GET_USE_TARGETS="" +_ruby_get_use_targets() { + debug-print-function ${FUNCNAME} "${@}" + local impls="${_RUBY_GET_ALL_IMPLS[@]}" - echo "${impls//ruby/ruby_targets_ruby}" + _RUBY_GET_USE_TARGETS="${impls//ruby/ruby_targets_ruby}" } # @FUNCTION: ruby_implementations_depend @@ -346,27 +357,36 @@ ruby_get_use_targets() { # ... # DEPEND="ruby? ( $(ruby_implementations_depend) )" # RDEPEND="${DEPEND}" +_RUBY_IMPLEMENTATIONS_DEPEND="" ruby_implementations_depend() { debug-print-function ${FUNCNAME} "${@}" + _ruby_implementations_depend + echo "${_RUBY_IMPLEMENTATIONS_DEPEND}" +} + +_ruby_implementations_depend() { + local depend _ruby_implementation for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" done - echo "${depend}" + _RUBY_IMPLEMENTATIONS_DEPEND="${depend}" } _ruby_get_all_impls +_ruby_get_use_targets +_ruby_implementations_depend -IUSE+=" $(ruby_get_use_targets)" +IUSE+=" ${_RUBY_GET_USE_TARGETS}" # If you specify RUBY_OPTIONAL you also need to take care of # ruby useflag and dependency. if [[ ${RUBY_OPTIONAL} != yes ]]; then - DEPEND="${DEPEND} $(ruby_implementations_depend)" - RDEPEND="${RDEPEND} $(ruby_implementations_depend)" - REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" + DEPEND="${DEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}" + RDEPEND="${RDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}" + REQUIRED_USE+=" || ( ${_RUBY_GET_USE_TARGETS} )" case ${EAPI} in 6) ;; - *) BDEPEND="${BDEPEND} $(ruby_implementations_depend)" ;; + *) BDEPEND="${BDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}" ;; esac fi