Rebase onto moritz++ performance improvements.