[#1553] Improve performance of encodeInitialLine