Add a cache around prettyprint_pv, since it is consuming a lot of CPU.