Performance optimizations in span parser