Garbage Collector Stuff

About
I always find it funny when people act like a GC is really slow, it's actually only a notable performance hit if your using cyclic types or trying to mitigate fragmentation, because of the way objects are stored in gced mem most of the time deleting a variable is tipically just a subtraction, unless it's 0 then it deletes it's children

Really what is typically bad about a GC is that it can't run on a thread due to it being a memory thing hence its a pause the world structure which is what's actually bad

Even cycle checking is such a well studied process that it's not horribly expensive

And you could copy nim and bake cycle checking into destructors, completely skipping it for all acyclic types

Tldr garbage collectors are actually super fast, they are just not thread safe

Links

Last Modified 2025 06/24