Improve the efficiency of descartes data padding

Output is the same, but should be orders of magnitude faster