Skip to content

Use sync.Pool to reduce lengthReader allocations #5756

@francislavoie

Description

@francislavoie

In #5461 we introduced lengthReader to count the amount of bytes read from the request body.

We're allocating a new lengthReader on each request though (but only requests with a body, so not GETs). This is inefficient, it could be improved by using sync.Pool to reuse allocated lengthReader structs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions