Skip to content

Avoid unnecessary buffer zero-fill in Snappy decompression #9579

@Dandandan

Description

@Dandandan

Description

Currently, Snappy decompression uses resize(len, 0) which zero-fills the buffer before writing. Since Snappy will overwrite the entire region on success, this memset is wasted work.

Proposed Change

Write directly into spare capacity using reserve() + spare_capacity_mut() + set_len(), eliminating the unnecessary zero-fill.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions