tensor5/haskell-happstack — pull request #8 by nponeccop (2014-12-25 17:21:24+00:00)
Title: Speedup updates.sh by caching Pacman output

After the patch `updates.sh` becomes an order of magnitude faster while remaining reasonably KISS.

It also lets you flexibly ignore or not ignore specific `pacman` repositories.

A yet another order of magnitude speedup is possible by using `join` and functional bash-fu. it's self-contained - paste to bash to see it mimicking `update.sh -b`:

join -e ccc -j1 -a1 \
<(cblrepo list -d --no-repo | awk '{print "haskell-" tolower($1) " " $1 " " $2}' | sort) \
<(pacman -Sl haskell-core | awk '{print $2 " " $3}' |sort) \
| awk '$3 != $4 {print}' \
| cut -d ' ' -f2 \
| xargs echo cblrepo add

Note that `join` is designed to only operate on sorted data and thus this approach avoids quadratic algorithms entirely.

But I'm not sure if it's KISS enough.