Performance optimizations for Lexer, plus a simplistic PerfStat class to view time & mem stats.