trivial performance related improvements
Merge pull request #2636 from jerrinot/papercuts

trivial performance related improvements