Skip to content

Testing to ensure upper bound for heap allocations #67

Description

@cobratbq

go-perfbook already explains how reducing heap allocations is a way to speed up execution and reduce GC delays, etc. I noticed, through example code from another developer, that it is possible to write tests such that one can effectively ensure a certain bound on heap allocations. This may be helpful for code/libraries that want to ensure/guarantee a low allocation count in specialized libraries, as well as prove that performance does not degrade (without noticing) over time due to changes in own code, Go standard library or run-time.

The test TestAllocations illustrates this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions