Performance boost: split out dicts and handle in isolation

When we encounter the start of a dict, parse out the whole thing and
process it in isolation so we're not still working with the entirety
of the PDF data unnecessarily.
Performance boost: optimise preg_match usage when fetching streams

Small improvement from using smaller substring and switching to offset
Performance boost: Switch on first four characters instead of ifs

Instead of using a chain of if/elseifs which all do their own matches on
the first few characters, just switch on the first four characters, which
is enough to identify which type of object it is. Also optimise objref/obj
branch to share a preg_match rather than potentially doing two preg_matches
which are nearly identical.