Create less garbage while parsing

The first patch is the big winner. On my 4000+ page test case, it reduced peak RSS during file loading from ~1130 MiB to ~800 MiB.

The last patch is a bit weird, but does avoid creating lots of strings, which reduces pressure on the GC.