perf improvements to message parsing