Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- dpv(){ command dpv -k -b "$0" -p "$items\n" -t "$*" -a "\nCombinations:" \
- -l "$total: "; }
- items="a b c d e f g h i j k l m n o p q r s t u v w x y z"
- total=$( cmb -t $items )
- start=$( date +%s )
- trap exit SIGINT
- clear
- cmb $items | dpv cmb
- end=$( date +%s )
- elapsed1=$(( $end - $start ))
- sixth=$(( $total / 6 ))
- export items
- start=$( date +%s )
- time echo \
- :$sixth \
- $(( $sixth + 1 )):$sixth \
- $(( $sixth * 2 + 1 )):$sixth \
- $(( $sixth * 3 + 1 )):$sixth \
- $(( $sixth * 4 + 1 )):$sixth \
- $(( $sixth * 5 + 1 )): \
- | xargs -P6 -n1 sh -c '
- start=${1%%:*} count=${1#*:}
- cmb ${start:+-i$start} ${count:+-c$count} $items
- ' sh | dpv "xargs -P6 cmb"
- end=$( date +%s )
- elapsed2=$(( $end - $start ))
- echo
- awk -v e1=$elapsed1 -v e2=$elapsed2 'BEGIN {
- printf "cmb: %us xargs: %us opt: %.2fx\n", e1, e2, e1 / e2
- }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement