You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Implement these traits in a more efficient way with the knowledge that wee_alloc has. grow for example, may be able to extend out the existing block of memory if the next cell is free. Maybe hide this behind a feature if it adds an appreciable amount of code bloat.
Would be helpful to have a benchmark here to see what the improvements are like. I imagine that things like pushing onto a vector in a loop ends up calling realloc quite a bit as the vector grows.
Motivation
The
Allocatortrait providesgrow()shrink()andgrow_zeroed()but they are implemented naively -shinkfor example allocates new memory, copies over bytes, and deallocates the old block of memory.realloccan be implemented for the GlobalAlloc trait withgrow()andshrink()under the hood.Proposed Solution
Implement these traits in a more efficient way with the knowledge that
wee_allochas.growfor example, may be able to extend out the existing block of memory if the next cell is free. Maybe hide this behind a feature if it adds an appreciable amount of code bloat.Would be helpful to have a benchmark here to see what the improvements are like. I imagine that things like pushing onto a vector in a loop ends up calling
reallocquite a bit as the vector grows.