- speed up dp and reduce code size