Cache text.size to improve performance for large strings
Reusing endpos to avoid another call to strlen
Merge pull request #99 from benharsh/regex

Regex: Cache string size to improve performance for large strings in matches iterator

In the regex-dna shootout, we need to count the number of matches in a very large string. With the current state of strings, calling text.size invokes strlen. Calling strlen on this very large string every time we look for a match is very slow. By caching the string's length, the performance of this iterator improves immensely.

Reviewed by sungeunchoi