Optimize packet parsing