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

[DO NOT MERGE] feat: reduce allocs & improve throughput #998

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jensneuse
Copy link
Member

...by introducing a limit buffer pool and fetch buffer heuristics

I figures out that we can reduce allocs by almost 50% and increase throughput by 30% by doing 2 changes:

  1. add a limit buffer pool to resolvable instead of using sync.Pool or no pool at all
  2. add heuristics to loader to estimate the ideal size of fetch buffers

Both changes reduce bytes.growSlice operations to almost zero in hot paths, see below.

before:

image

after:

image

v2/pkg/pool/limitbufferpool.go Outdated Show resolved Hide resolved
@jensneuse jensneuse closed this Nov 26, 2024
@jensneuse jensneuse reopened this Nov 27, 2024
@jensneuse jensneuse changed the title feat: reduce allocs & improve throughput [DO NOT MERGE] feat: reduce allocs & improve throughput Nov 27, 2024
@jensneuse
Copy link
Member Author

We want to merge this at a later stage once we have better testing architecture in place.

@StarpTech StarpTech marked this pull request as draft November 27, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants