"This could get the same treatment as /etc/passwd if it becomes a burden. In the meantime, if it's a performance bottleneck, make a memoizing function to lookup groups and use a '-n' switch to ls."
Exactly, and this is the sort of thing that can be done with open source software. It may not even be a lot of code depending on how it is approached.