Use compiler optimizations to speed up execution

Fixes #16