Skip to content

Commit

Permalink
lib/helpers: fix all_groups()
Browse files Browse the repository at this point in the history
- 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
```
  • Loading branch information
gaelicWizard committed Jan 3, 2022
1 parent 8fafe65 commit 3fd97b4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1047,14 +1047,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
Expand Down

0 comments on commit 3fd97b4

Please sign in to comment.