Skip to content

refactor(nullreader): use clear() builtin for zero-fill#13529

Open
rvagg wants to merge 1 commit intomasterfrom
rvagg/clearnullreader
Open

refactor(nullreader): use clear() builtin for zero-fill#13529
rvagg wants to merge 1 commit intomasterfrom
rvagg/clearnullreader

Conversation

@rvagg
Copy link
Member

@rvagg rvagg commented Feb 26, 2026

Uses a single memclr under the hood instead of the loop.

This gets used in a few places, clear() has been a Go optimisation for a few years now.

Uses a single `memclr` under the hood instead of the loop.
Copilot AI review requested due to automatic review settings February 26, 2026 11:33
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Feb 26, 2026
@rvagg rvagg requested a review from ZenGround0 February 26, 2026 11:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the nullreader zero-fill implementation to use Go’s clear() builtin, which the compiler can optimize into an efficient bulk zeroing operation (e.g., memclr) rather than a manual loop.

Changes:

  • Replace per-byte zeroing loop in Reader.Read with clear(out).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Feb 26, 2026
@rvagg rvagg added the skip/changelog This change does not require CHANGELOG.md update label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does not require CHANGELOG.md update

Projects

Status: 🔎 Awaiting Review

Development

Successfully merging this pull request may close these issues.

2 participants