4 ms·
Perhaps cheaper in space, but you will have to do an initial pass over the entire structure to zero your visited bits first, so it may not be cheaper in time.
by jmts 8y ago
Perhaps cheaper in space, but you will have to do an initial pass over the entire structure to zero your visited bits first, so it may not be cheaper in time.
- WalterBright 8y agoYou have to walk the hash table again to free it.
- ufo 8y agoThe GC already needs to sweep through the whole allocated memory to find the unreacheble objects to be freed. Flipping a bit while doing this isnt a big deal.
- stcredzero 8y agoJust ensure the bits are always zero on allocation, use DFS, and ensure you re-zero the bits on the way out.
- WalterBright 8y agoSince the first pass quit when it finds the first marked node, the zeroing can traverse the structure, erasing marked bits, and stopping at the first 0. The entire structure doesn't have to be visited.
- stcredzero 8y agoThe entire structure doesn't have to be visited. We are both saying this.