3 ms·
Is there a way for the compiler or the runtime to be designed such that it can detect that these heap allocations of the same "shape" and similar size are happe
by tareqak 9y ago
Is there a way for the compiler or the runtime to be designed such that it can detect that these heap allocations of the same "shape" and similar size are happening with sufficient frequency/regularity that some optimization is possible?
- cocoa19 9y agoYes, it can be done. I don't know about Go, but this is already done for other languages. In C/C++, you can override the memory allocation functions (malloc, delete, new, free, etc) based on the type of heap objects you are going to handle. Most or all C and C++ standard libraries come with generic allocators that work OK in most scenarios, but not optimally for specific scenarios.