Skip to content

⚡ Bolt: [performance improvement] Avoid intermediate string allocations during formatting - #16

Merged
SayanthRock merged 1 commit into
mainfrom
bolt/optimize-string-concatenation-224525407258933739
Aug 17, 2026
Merged

⚡ Bolt: [performance improvement] Avoid intermediate string allocations during formatting#16
SayanthRock merged 1 commit into
mainfrom
bolt/optimize-string-concatenation-224525407258933739

Conversation

@SayanthRock

@SayanthRock SayanthRock commented Aug 16, 2026

Copy link
Copy Markdown
Member

💡 What

Replaced intermediate string allocations (.join()) with direct writes to Formatter (in rockql-ast) and string buffers (in rockql-sql).

🎯 Why

In hot paths like SQL compilation and AST formatting, relying on .join() and intermediate .map().collect::<Vec<_>>().join() operations causes substantial unnecessary heap allocation for short-lived Strings and Vecs.

📊 Impact

Reduces heap memory allocations and avoids O(N) temporary vectors during query formatting and compilation, improving overall execution speed for these phases.

🔬 Measurement

Run cargo bench or profile memory allocations during query compilation to verify reduced heap traffic. Run cargo test to ensure semantics remain perfectly identical.


PR created automatically by Jules for task 224525407258933739 started by @SayanthRock

PR Description from Zenable

Replaces intermediate string allocations (.join() with temporary Vec<String>) with direct writes to Formatter (in rockql-ast) and string buffers (in rockql-sql) for hot paths like SQL compilation and AST formatting.

  • Refactored Display impls for Transform::Select and Transform::Sort to write directly to the Formatter
  • Replaced .join() calls in the SQL compiler for filters and sort items with direct iteration and buffer writes
  • Added a learning log entry in .jules/bolt.md documenting this optimization pattern
  • Semantics are identical; verified by cargo test

- Optimize `Display` for `Transform::Select` and `Transform::Sort` to avoid `Vec` allocations and `.join()`.
- Optimize SQL concatenation in `rockql-sql` to push to string buffer directly.

Co-authored-by: SayanthRock <202829406+SayanthRock@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.

@ai-coding-guardrails

Copy link
Copy Markdown

You've hit your review limit for the week, but don't worry you'll get some more next week!

Contact us at hello@zenable.io if you want this rate limit to go away

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aec57ad0-f6e7-4c47-b3c6-cd56db379913

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SayanthRock
SayanthRock marked this pull request as ready for review August 17, 2026 02:30
Copilot AI lite review requested due to automatic review settings August 17, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@SayanthRock
SayanthRock merged commit e9ce088 into main Aug 17, 2026
4 checks passed

@ai-coding-guardrails ai-coding-guardrails Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work! 😎

I didn't find anything of concern

Risk: 🟢 Low

Risk analysis

The highest scoring dimensions are blast_radius and reversibility due to the changes being in shared compiler components (rockql-ast and rockql-sql) that could affect multiple downstream consumers of SQL generation and AST formatting. The change modifies core formatting logic in ways that, while performance-oriented, touch widely-used code paths. Test coverage received a minimal score because the patches alter display and string construction behavior without adding new tests to validate the optimized paths, relying instead on existing tests to catch potential semantic drift.

Reviewed with 🤟 by Zenable

@ai-coding-guardrails ai-coding-guardrails Bot added the zenable/risk:low Zenable assessed this PR as LOW risk. label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zenable/risk:low Zenable assessed this PR as LOW risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants