Skip to content

⚡ Bolt: Optimize i18n KeyExtractor agent regex compilation and string slicing#35

Merged
MagdielCAS merged 6 commits into
mainfrom
bolt-perf-i18n-agents-17994026744817887052
May 14, 2026
Merged

⚡ Bolt: Optimize i18n KeyExtractor agent regex compilation and string slicing#35
MagdielCAS merged 6 commits into
mainfrom
bolt-perf-i18n-agents-17994026744817887052

Conversation

@MagdielCAS
Copy link
Copy Markdown
Owner

💡 What: Extracted five regexp.MustCompile calls out of the Execute loop in KeyExtractor and into a package-level variable i18nPatterns to compile them only once. Additionally, replaced strings.Split on the diff string with a zero-allocation strings.IndexByte and manual slicing loop.

🎯 Why: In KeyExtractor.Execute, the regex compilation was occurring on every execution, and strings.Split was creating a huge slice of strings for the entire diff block in memory. This improves runtime significantly, especially for large inputs.

📊 Impact: Reduces regex initialization speed by ~25x and reduces allocations drastically on diff line separation.

🔬 Measurement: Benchmarks were run (bench_test.go and bench2_test.go) directly on the diff loop logic and regex execution to verify the improvement.


PR created automatically by Jules for task 17994026744817887052 started by @MagdielCAS

…icing

Extracted five `regexp.MustCompile` calls out of the `Execute` loop in `KeyExtractor` and into a package-level variable `i18nPatterns` to compile them only once. Additionally, replaced `strings.Split` on the `diff` string with a zero-allocation `strings.IndexByte` and manual slicing loop to prevent creating massive slice arrays.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

MagdielCAS and others added 3 commits March 4, 2026 09:37
…icing

Extracted five `regexp.MustCompile` calls out of the `Execute` loop in `KeyExtractor` and into a package-level variable `i18nPatterns` to compile them only once. Additionally, replaced `strings.Split` on the `diff` string with a zero-allocation `strings.IndexByte` and manual slicing loop to prevent creating massive slice arrays.

Also fixed the GitHub Actions internal-ci workflow to correctly push to `HEAD:${{ github.head_ref }}` during pull requests.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@MagdielCAS
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Agent-Logs-Url: https://github.com/MagdielCAS/magi-cli/sessions/7f6962ad-f3e4-4384-818c-29cb42b9db11

Co-authored-by: MagdielCAS <7864626+MagdielCAS@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 3c0566b. I merged main into this branch, fixed the conflicts in the i18n agent/docs/bolt notes, and re-ran the Go test suite plus final validation successfully.

@MagdielCAS MagdielCAS marked this pull request as ready for review May 14, 2026 09:13
@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

git push origin HEAD:${{ github.head_ref }}

P2 Badge Checkout PR head ref before pushing docs updates

In .github/workflows/internal-ci.yml I checked the pull_request path and this push now targets ${{ github.head_ref }} without changing the checkout ref first. actions/checkout on PR events runs in detached HEAD on the merge ref by default, so committing and then pushing HEAD can write a commit based on the synthetic merge commit back to the contributor branch (or fail under linear-history/protection rules). Add ref: ${{ github.head_ref }} for PR runs (or a separate checkout step) so commits are made on the actual PR branch tip.

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

@MagdielCAS MagdielCAS merged commit a974abc into main May 14, 2026
3 checks passed
@MagdielCAS MagdielCAS deleted the bolt-perf-i18n-agents-17994026744817887052 branch May 14, 2026 09:20
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.

2 participants