Some minor performance optimizations along with a typo fix in benchmark.sh.