This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Cache SizeClassForTransferBatch in the 32-bit local cache
ClosedPublic

Authored by cryptoad on Apr 21 2017, 11:51 AM.

Details

Summary

SizeClassForTransferBatch is expensive and is called for every CreateBatch
and DestroyBatch. Caching it means kNumClasses calls in InitCache
instead. This should be a performance gain if more than kNumClasses / 2
batches are created and destroyed during the lifetime of the local cache.

I have chosen to fully remove the function and putting the code in InitCache,
which is a debatable choice.

In single threaded benchmarks leveraging primary backed allocations, this turns
out to be a sizeable gain in performances (greater than 5%). In multithreaded
benchmarks leveraging everything, it is less significant but still an
improvement (about 1%).

Event Timeline

cryptoad created this revision.Apr 21 2017, 11:51 AM
dvyukov accepted this revision.Apr 21 2017, 12:12 PM
This revision is now accepted and ready to land.Apr 21 2017, 12:12 PM
cryptoad updated this revision to Diff 96221.Apr 21 2017, 1:37 PM

Moving a comment a few lines up, as it makes more sense.

cryptoad closed this revision.Apr 24 2017, 8:06 AM