Skip to content

optimize command execution by reducing redundant clones - #1

Draft
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
bolt-optimize-exec-clones-12509606152894841637
Draft

optimize command execution by reducing redundant clones#1
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
bolt-optimize-exec-clones-12509606152894841637

Conversation

@google-labs-jules

@google-labs-jules google-labs-jules Bot commented Jan 19, 2026

Copy link
Copy Markdown

This PR optimizes the src/bootstrap tool by reducing unnecessary data cloning and redundant calculations.

💡 What:

  1. Shared Output Storage: Changed CommandOutput to store stdout and stderr as Option<Arc<[u8]>> instead of Option<Vec<u8>>.
  2. Avoid Redundant Fingerprinting: Updated finish_process to accept a pre-calculated CommandFingerprint instead of recalculating it from the BootstrapCommand.

🎯 Why:

  • Performance: CommandOutput is frequently cloned when retrieved from the CommandCache or during step execution. With Vec<u8>, this was an $O(N)$ operation. With Arc<[u8]>, it's $O(1)$.
  • Efficiency: command.fingerprint() is a relatively expensive operation that clones all command arguments and environment variables. Calling it again in finish_process was redundant since the fingerprint was already available in wait_for_output.

📊 Impact:

  • Reduces data cloning on every cache hit. For commands with large outputs, this significantly reduces memory pressure and CPU time.
  • Reduces redundant allocations on the failure/verbose reporting path.

🔬 Measurement:

  • Verified with python3 x.py check src/bootstrap and python3 x.py test src/bootstrap.
  • Internal tests for command execution pass as expected.

PR created automatically by by @lang-tempo

This commit optimizes the bootstrap build system by:
1. Changing `CommandOutput` to use `Arc<[u8]>` instead of `Vec<u8>` for captured stdout/stderr. This makes `CommandOutput` cloning O(1) and avoids redundant data copying when retrieving command results from the cache.
2. Avoiding redundant `fingerprint()` calculations in `DeferredCommand::finish_process` by passing the already existing fingerprint from the caller.

These changes reduce memory allocations and data copying during the build process, especially for commands that are frequently cached or have large outputs.
@google-labs-jules

google-labs-jules Bot commented Jan 19, 2026

Copy link
Copy Markdown
Author

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

@OpenPay-App OpenPay-App changed the title ⚡ Bolt: optimize command execution by reducing redundant clones optimize command execution by reducing redundant clones Jan 19, 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.

0 participants