Some parsing tweaks to reduce memory consumption

The first patch, which introduces the Name cache, is the most effective. On a 4,125 page PDF it reduces peak memory consumption during parsing from ~800 MiB to ~750 MiB.

The other two patches provide smaller improvements.