More performance optimizations (this batch seemed to make a pretty big
difference in my benchmark project)