Skip to content
Snippets Groups Projects
Commit c3f655b5 authored by Joseph Pecoraro's avatar Joseph Pecoraro Committed by Marijn Haverbeke
Browse files

Improve performance of StringStream with long lines (match)

StringString.prototype.match(<string>) 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.
parent f97e5a6e
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment