Some gentle vector optimizations (caching, Pi calc)