Avoid lowercasing the remaining buffer on each scan step
skipXMLIgnoredSection is called at nearly every byte position by ContainsToolMarkupSyntaxOutsideIgnored, FindToolMarkupTagOutsideIgnored, and the XML block scanners; computing strings.ToLower(text[i:]) inside that hot path allocates and copies the entire tail each time. This changes previously linear scans into quadratic time/memory behavior on long assistant responses (especially those without CDATA/comments), which can cause major latency spikes or parser slowdowns in production.
Useful? React with 👍 / 👎.
Originally posted by @chatgpt-codex-connector[bot] in #453 (comment)
skipXMLIgnoredSectionis called at nearly every byte position byContainsToolMarkupSyntaxOutsideIgnored,FindToolMarkupTagOutsideIgnored, and the XML block scanners; computingstrings.ToLower(text[i:])inside that hot path allocates and copies the entire tail each time. This changes previously linear scans into quadratic time/memory behavior on long assistant responses (especially those without CDATA/comments), which can cause major latency spikes or parser slowdowns in production.Useful? React with 👍 / 👎.
Originally posted by @chatgpt-codex-connector[bot] in #453 (comment)