Use a cache to minimize the number of Name objects.

This reduces peak RSS on large PDFs.