Skip to content

perf: reduce allocations in the printer and string-list sorting - #1476

Open
jbedard wants to merge 1 commit into
bazel-contrib:mainfrom
jbedard:no-copy-when-no-nil
Open

perf: reduce allocations in the printer and string-list sorting#1476
jbedard wants to merge 1 commit into
bazel-contrib:mainfrom
jbedard:no-copy-when-no-nil

Conversation

@jbedard

@jbedard jbedard commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Buildtools PR checklist

  • The code in this PR is covered by unit/integration tests.
  • I have tested these changes and provide testing instructions below.
  • I have either responded to, or resolved all Gemini comments on the PR.
  • I have read Google Eng Practices on Small Changes, this PR either follows these guidelines or the description provides reasoning for why they can not be followed.

Description

Reduce array copying to only when necessary, which seems like the exception and not the norm.

@jbedard
jbedard requested a review from a team as a code owner June 10, 2026 04:00
@jbedard
jbedard requested review from oreflow and removed request for a team June 10, 2026 04:00

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the seq method in build/print.go by only copying the argument slice when a nil element is present. The reviewer suggested a further optimization to avoid a full second pass over the slice by copying the non-nil prefix and iterating only over the remaining elements.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread build/print.go
@jbedard
jbedard force-pushed the no-copy-when-no-nil branch from 1216415 to b0c00d5 Compare June 25, 2026 21:18
@oreflow
oreflow removed their request for review August 24, 2026 05:28
@oreflow

oreflow commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Cleaning up past reviewers due to lack of capacity, and buildtools were now moved to be bazel-contrib community supported.

@jbedard
jbedard force-pushed the no-copy-when-no-nil branch from b0c00d5 to a5eaa2f Compare August 25, 2026 17:35
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