(#1872) - optimize utils.parseDoc()

Apparently the `reduce()` in `parseDoc()` is also a hotpath.  Will try to provide some performance numbers tomorrow, unless you guys are satisfied merely by the reduction in code.