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

Jumbo allocation performance #7

Closed
fengb opened this issue Sep 3, 2019 · 3 comments
Closed

Jumbo allocation performance #7

fengb opened this issue Sep 3, 2019 · 3 comments

Comments

@fengb
Copy link
Owner

fengb commented Sep 3, 2019

ZeeAlloc does really poorly with variable-sized jumbo allocations. We should investigate a better way to reference these frames.

Detailed problem:

  1. Jumbo frames are all stuck into a (singly) linked list
  2. Only specific matches will fit jumbo frames (search size == frame size)

Potential solutions:

  • Make search size <= frame size — this speeds up variable reuse at the cost of hurting exact size reuse and internal fragmentation
  • Increase "page size" — this only punts the problem as well as causing more internal fragmentation
  • Powers of 2 for jumbo — more internal fragmentation, still poor performance for lots of simultaneous allocations
@fengb
Copy link
Owner Author

fengb commented Sep 4, 2019

wee_alloc has O(n) allocations, so maybe we should follow suit.

Interestingly, it also does "first fit", which matches our first "fix" strategy.

@fengb
Copy link
Owner Author

fengb commented Sep 5, 2019

First fit has a hugely degenerate case where smaller frames tend to bubble into the back of the list and never match again because larger ones are in front and always match. Potential alternatives are:

  • closest fit — slowest O(n) but should rarely degenerate
  • reasonable fit (e.g. < 2*n)— still have early exits but less predictable

@fengb
Copy link
Owner Author

fengb commented Sep 5, 2019

Default to closest fit, with options for exact or first.

@fengb fengb closed this as completed Sep 5, 2019
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

No branches or pull requests

1 participant