Skip to content

[diffs] reduce patch parsing string retention#686

Merged
amadeus merged 3 commits into
beta-1.2from
amadeus/parsing-memory-improvements
May 16, 2026
Merged

[diffs] reduce patch parsing string retention#686
amadeus merged 3 commits into
beta-1.2from
amadeus/parsing-memory-improvements

Conversation

@amadeus
Copy link
Copy Markdown
Member

@amadeus amadeus commented May 16, 2026

This was definitely a moment of jesus take the wheel. I let codex go a bit deeper on figuring out how to optimize memory usage and performance when it came to parsing diffs.

I don't have the numbers but i think parsing was improved by at like 50% and memory usage scales immensely as the file size grows.

An example of improved memory usage:

BEFORE:
IMG_5353

AFTER:
IMG_6803

@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffshub Ready Ready Preview May 16, 2026 7:53am
pierre-docs-trees Ready Ready Preview May 16, 2026 7:53am
pierrejs-diff-demo Ready Ready Preview May 16, 2026 7:53am
pierrejs-docs Ready Ready Preview May 16, 2026 7:53am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 937c550e76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/diffs/scripts/benchmarkParsePatchFiles.ts Outdated
@amadeus
Copy link
Copy Markdown
Member Author

amadeus commented May 16, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dca8e4fe2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

if (!hasSurrogateCodeUnit(value)) {
return stringDetachDecoder.decode(stringDetachEncoder.encode(value));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve BOM when detaching string storage

Using TextDecoder with default options strips a leading UTF-8 BOM, so detachString() mutates valid content ("\uFEFF..." becomes "...") instead of just cloning backing storage. This commit routes parsed hunk lines, filenames, and metadata through detachString, so patches touching BOM-prefixed files lose the first character and produce incorrect parsed output.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant