File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 4141//
4242// Wait-free? (maybe the CMPX is only lock-free?)
4343
44+ /* * @note
45+ * There's a bit of a debate if using the stack pointer (address of a local variable)
46+ * is quicker than getting the thread ID. A rudimentary benchmark (below) shows
47+ * getting this is the same on clang 17 and GCC 13.2:
48+ * https://quick-bench.com/q/iTnk1X3mGYUQ2yryuK_Wcg6JJ6Q
49+ *
50+ * When detecting if there is a data-race, comparing thread IDs is very quick. I
51+ * would expect finding if two addresses are on the same stack is more costly as
52+ * it involves extra calls to get the base stack address. It's also more complex
53+ * in terms of code. Ultimately however, real-word benchmarks would need to be
54+ * created to compare without a data_race_checker, one using thread IDs and one
55+ * using addresses.
56+ */
57+
4458namespace scl {
4559
4660#ifndef DATA_RACE_DETECTED
You can’t perform that action at this time.
0 commit comments