Skip to content

Reduce Unnecessary Allocations #320

@nickajacks1

Description

@nickajacks1

In profiling my application, I noticed that packets.ReadPacket was making extra unnecessary allocations by calling io.CopyN (which internally allocates its own temporary buffer). In this example, we can just call r.Read to eliminate that extra allocation. I would like to comb through the code (or at least the codepaths my applications use :) ) and see if there are any other low hanging fruit as well.

(I'm making this issue as somewhat of a formality since the PR template says to open an issue first.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions