performance improvements to parse

1) Replaced buf.push(...) with buf[buf.length] =
2) Replaced string.substr(i, 1) with string[i]
3) Cached str[i]

Dropped parse times for my test file from ~300ms to ~180ms