shredder icon indicating copy to clipboard operation
shredder copied to clipboard

`do_collect` needs optimized

Open Others opened this issue 5 years ago • 1 comments

We can probably allocate less in this method, and rayon could be used to speed up the scanning process.

Others avatar Jan 30 '20 21:01 Others

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

Others avatar Jun 05 '20 02:06 Others