Join GitHub today
runtime: adjust _HeapAllocChunk dynamically to improve performance #16866
I know there is a huge desire to limit the number of user-facing variables for memory allocation and garbage collection, but through internal testing @rw found that increasing
I realize that opening this up for user modification might be a non-starter, but I figured I'd bring it up for discussion since the 1.8 dev cycle is kicking off. Curious to hear what you guys think about this. Let me know if you've got any questions about our use case or testing.
Here's a quick patch for the change that @rw put together:
Interesting. @toddboom, can you describe your workload, in particular how it grows/shrinks the heap over time and how much heap it uses? A GODEBUG=gctrace=1 log would be particularly concrete. Even better would be a benchmark that exhibits the improvement with this change.
Rather than adding a knob, I suspect we could just adjust this dynamically. If the heap is large already, allocate more heap in larger chunks.
referenced this issue
Sep 29, 2016
Given the admitted "huge desire to limit the number of user-facing variables for memory allocation and garbage collection", I think it's pretty clear we're not going to make one just for this one setting. We'd love to hear more about the bigger context here, though, and adjust it automatically in the runtime as appropriate. Thanks.