Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce allocations in per-request methods to improve performance #395

Merged
merged 3 commits into from
Mar 27, 2019

Commits on Mar 26, 2019

  1. Prevent additional allocations when sorting routes for selection

    Use of an uninitialized array and the use of sort.Reverse cause
    extra allocations in request routing which are unnecessary.
    smarterclayton committed Mar 26, 2019
    Configuration menu
    Copy the full SHA
    1c8d3cf View commit details
    Browse the repository at this point in the history
  2. Reduce allocations in Accept and Content-Type matching

    The mime handling methods can do a single pass over the header without
    needing to allocate. This improves performance of these methods in
    higher traffic API servers.
    smarterclayton committed Mar 26, 2019
    Configuration menu
    Copy the full SHA
    831c767 View commit details
    Browse the repository at this point in the history
  3. Reduce allocations in route selection

    The use of new arrays for each phase of detectRoute can be simplified:
    each pass filters the existing array and whatever is left at the end
    is returned. While somewhat harder to read, this method is a significant
    source of allocations.
    smarterclayton committed Mar 26, 2019
    Configuration menu
    Copy the full SHA
    69edaef View commit details
    Browse the repository at this point in the history