marijnh/CodeMirror — pull request #1303 by JosephPecoraro (2013-03-01 21:49:21+00:00)
Title: Improve performance of StringStream with long lines (match)

StringString.prototype.match() may do a lot of unnecessary work:

- If it is caseInsensitive it was calling toLowerCase on the entire string.
- It did an indexOf search through the string for a pattern, but only cared
if the string started with that pattern.

Because a string pattern has a fixed length, we only need to run toLowerCase
on a small substring of the stream, and we only compare this small substring
to the pattern.