shredder
shredder copied to clipboard
`do_collect` needs optimized
We can probably allocate less in this method, and rayon
could be used to speed up the scanning process.
We're using rayon now. The biggest future optimization is this one for determining what's rooted:
- Track an "invalidation number" for each handle, a u64 that's incremented whenever a lockout is taken
- For each object, take lockout if possible, then mark each interior handle as not rooted, recording invalidation num
- Then go through handles. Mark as non-rooted if marked as non-rooted and invalidation number not incremented (this is necessarily conservative. If it is marked non-rooted and the invalidation number was not incremented, it’s still effectively in place—only the set of roots can increase)
- Then freeze everything so scanning can see a consistent view of the system
- Then proceed as usual