Skip to content

perf: reduce use of printf for printing spaces/indentation#1474

Open
jbedard wants to merge 1 commit into
bazelbuild:mainfrom
jbedard:skip-printf
Open

perf: reduce use of printf for printing spaces/indentation#1474
jbedard wants to merge 1 commit into
bazelbuild:mainfrom
jbedard:skip-printf

Conversation

@jbedard

@jbedard jbedard commented Jun 10, 2026

Copy link
Copy Markdown

In a large repo the unnecessary use of Printf is actually fairly significant.

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

What does this PR do? Please follow Google Eng Practices - Description

(optional) These changes were tested using the following steps

Steps to reproduce / test the PR changes (if anything besides unit tests).

@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 printer implementation in build/print.go by replacing the allocation-heavy printf method with specialized, more efficient methods: spaces, prints, and printc. Feedback suggests replacing the mutable global spaceBytes slice with an immutable const string to eliminate the risk of accidental mutation and ensure safety.

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 Outdated
@jbedard jbedard marked this pull request as ready for review June 10, 2026 03:50
@jbedard jbedard requested a review from a team as a code owner June 10, 2026 03:50
@jbedard jbedard requested review from vladmos and removed request for a team June 10, 2026 03:50
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