Improve TokenUtils performance through caching

For #9717.

For testing, you can take https://gist.github.com/MarcelGerber/5c11f1031af292044708, placing your cursor in the script tags and pressing `Ctrl-Space`.
Another idea is to keep track of last token, and pass in a prev/next/random flag to provide a hint where to start search. But, this may only work if each context has it's own cache.