Skip to content

speed up http considerably via fix for io.Discard #2084

@msolo

Description

@msolo
When the http body is closed, io.Copy(ioutil.Discard, ...) needlessly allocates a new
buffer every time.

This seems pretty minor but the effect is considerable.

My most recent tests bump from 3000qps -> 3800qps after this change.

Since this is just discard, I don't *think* there a race stomping the underlying data
since each call to read is using a distinct slice.

Attachments:

  1. ioutil-discard.patch (729 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions