Skip to content

Avoid lowercasing the remaining buffer on each scan step #454

@CJackHwang

Description

@CJackHwang

P1 Badge 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodex

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions