~50x speedup from expand lookup table and switching from vectors to C-style arrays