Here's a parallel implementation that gets me 950 commits per second:
manycommits() {
h=@; t=`git rev-parse @^{tree}`
for i in `seq 2 "$1"`; do
h=`echo "$*" | git commit-tree $t -p $h`
done
echo $h
}
twice() { "$@" a & "$@" b ; wait; }
twice twice twice twice manycommits 10000 | while read h; do git merge --no-edit $h; done