Faster tree parsing

This patch results in a significant speedup for workloads that involve parsing a lot of trees. It also reduces 29 lines of code down to 3.

There are two optimizations:

1. Eliminate a slow manual conversion from base10 string to base8 integer. This actually showed up as a hot spot while profiling.

2. Use a regex to parse the tree object itself, instead of doing byte-by-byte comparisons.