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`.
`_.find()` iterates over list which is a sequential search. For *really* long lines of text (e.g. minified files), it's probably worth implementing a binary search here.