From 180fb93df8a0957a008ef2eac61fb4a01886e054 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Thu, 23 Sep 2021 09:55:11 -0700 Subject: [PATCH] lib/helpers: fix `all_groups()` - Don't write to disk, just pipe. - Don't loop, just do all functions. Performance of old implementation on my system: ``` real 0m9.996s user 0m5.318s sys 0m9.126s ``` Performance of new implementation on my system: ``` real 0m0.052s user 0m0.069s sys 0m0.025s ``` --- lib/helpers.bash | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 01211079..e8fb42d1 100755 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -1039,14 +1039,7 @@ all_groups () about 'displays all unique metadata groups' group 'lib' - typeset func - typeset file=$(mktemp -t composure.XXXX) - for func in $(_typeset_functions) - do - typeset -f $func | metafor group >> $file - done - cat $file | sort | uniq - rm $file + declare -f | metafor group | sort -u } if ! type pathmunge > /dev/null 2>&1