runtime (gc): switch to a best-fit allocator #1181
Conversation
|
I ran
It would however be nice to test this with a more realistic workload. |
|
Skimming through the diff in code size, it looks like there is a code size increase of about 300 bytes in most cases (source: https://gist.github.com/aykevl/eb1239dc0290fe79251e5fd7995b437a). This cost should be considered. It may be worthwhile still but such an increase can be a problem on small chips (especially something like AVR, that will likely have a bigger increase because of the less compact instruction set). I would like to hear other views on this. Even though ~300 bytes may not sound like much, many of these changes quickly add up, especially for a feature that may not be necessary for many programs. It may be an idea to see whether it's possible to somehow split the GC into two: one baseline GC (what we have right now) and one that uses roughly the same (conservative) algorithm but with optimizations like this PR provides, for more GC-heavy programs. |
I think this is more important on AVR than it is on other instruction sets. This isn't a performance optimization, this is a reliability change. However, I think we might actually be better off with an entirely separate collector for very tiny heaps, where we use a small compile-time-sized array of words for the metadata. This could make the collector a lot smaller. I can try this out in a separate PR. This would not be the same algorithm; it would be simpler. |
|
Same thing on this PR, curious about the status @niaow ? |
|
I am abandoning this. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

This replaces #1039. It should be a lot more efficient. When inspecting the heap while running
testdata/gc.go, I found that there were typically only 3 free spans at any given time. I think this should substantially improve our situation with fragmentation.