Skip to content

⚡ Bolt: Pre-compile Regex in dictionary loops to eliminate allocations - #623

Merged
LeanBitLab merged 1 commit into
mainfrom
bolt/precompile-regex-dictionaries-1025679069376110650
Oct 7, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
bolt/precompile-regex-dictionaries-1025679069376110650

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

💡 What: Extracted inline Regex("\\s+") instances within the dictionary processing loops of AppsBinaryDictionary and UserBinaryDictionary to pre-compiled SPACE_REGEX companion object properties.

🎯 Why: To eliminate unnecessary allocations and runtime Regex compilation overhead that previously occurred on every single word or app iteration during dictionary population.

📊 Expected Impact: Reduced garbage collection pressure and slightly faster dictionary loading in hot paths during typing or background updates.

🔬 Verification: Clean builds with ./gradlew :app:assembleStandardDebug and all unit tests passed with ./gradlew :app:testStandardDebugUnitTest. Verified zero regressions and no introduced em dashes.


PR created automatically by Jules for task 1025679069376110650 started by @LeanBitLab

@google-labs-jules

Copy link
Copy Markdown

👋 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.

Extracted inline `Regex("\\s+")` instances within the processing loops of `AppsBinaryDictionary` and `UserBinaryDictionary` to static `SPACE_REGEX` companion object properties. This eliminates the runtime regex compilation overhead that would otherwise execute on a per-word or per-app basis.
@LeanBitLab
LeanBitLab force-pushed the bolt/precompile-regex-dictionaries-1025679069376110650 branch from a3f4b5c to bb9afec Compare October 7, 2026 12:13
@LeanBitLab
LeanBitLab merged commit b91fc5a into main Oct 7, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the bolt/precompile-regex-dictionaries-1025679069376110650 branch October 7, 2026 12:13
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