Skip to content

perf: combine source_contents scans in encode_to_string#289

Merged
Boshen merged 2 commits intomainfrom
perf/combine-source-contents-scan
Mar 20, 2026
Merged

perf: combine source_contents scans in encode_to_string#289
Boshen merged 2 commits intomainfrom
perf/combine-source-contents-scan

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented Mar 20, 2026

Summary

  • Combine the .any() check and the byte-length accumulation loop over source_contents into a single fold, avoiding two iterations over the collection during capacity estimation in encode_to_string.

🤖 Generated with Claude Code

Boshen and others added 2 commits March 20, 2026 21:06
Combine the `.any()` check and the byte-length accumulation loop into a
single `fold`, avoiding two iterations over `source_contents`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 20, 2026

Merging this PR will degrade performance by 1.08%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 1 regressed benchmark
✅ 8 untouched benchmarks
⏩ 5 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
serialize[real_small] 4.4 µs 4.3 µs +1.42%
serialize[real_medium] 5 µs 4.9 µs +2.38%
lookup_table[real_small] 1.4 µs 1.4 µs +2.13%
lookup_table[real_medium] 1.5 µs 1.5 µs +1.97%
parse[real_medium] 16.1 µs 16.2 µs -1.08%

Comparing perf/combine-source-contents-scan (ae83d65) with main (b7fe1cf)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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: ae83d655c5

ℹ️ 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".

@Boshen Boshen merged commit 152c2bb into main Mar 20, 2026
7 checks passed
@Boshen Boshen deleted the perf/combine-source-contents-scan branch March 20, 2026 13:12
@Boshen Boshen mentioned this pull request Mar 20, 2026
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