altamimi513 / data-race-test

Automatically exported from code.google.com/p/data-race-test
0 stars 0 forks source link

Optimize HappensBefore by not comparing VTS with VTS #70

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I did some local hacking of thread_sanitizer.cc and it turns out we need to do 
full-VTS comparison only in NewSegmentForWait().

In all other places we can just compare the current VTS with a TID/clock of the 
"old" Segment.
On the slow path this can be done in O(log N) instead of O(N+M) time.

This may speed up TSan a little bit, but we don't expect a significant 
difference since HappensBefore is already cached (i.e. amortized O(1) on the 
fast path).

However, if we get rid of the optimization requiring HappensBefore() call in 
the NewSegmentForWait() we may drop VTSes from the Segments and this would save 
us a lot of space.

Ideas?

Original issue reported on code.google.com by timurrrr on 3 Jun 2011 at 12:05

GoogleCodeExporter commented 8 years ago
Wow, looks like this has never made it to trunk :(

Attaching a patch against r3386 in case we need it once more

Original comment by timurrrr on 13 Dec 2011 at 5:32

Attachments: