-
Notifications
You must be signed in to change notification settings - Fork 6
Effect of replacing RMW atomics with load non atomic modify store in OL critical sections
Laurynas Biveinis edited this page Mar 8, 2021
·
8 revisions
The initial implementation used relaxed_atomic in optimistic lock critical sections, including writer sections. This resulted in increments and decrements compiling to atomic RMW operations, where a non-atomic equivalent would suffice. Fixed by along the lines of replacing value.fetch_add(1, std::memory_order_relaxed) with value.store(value.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed).
The effect of this change:
$ python3 ../../3rd_party/benchmark/tools/compare.py benchmarks ../../../unodb/build.release/benchmark/micro_benchmark_key_prefix ./micro_benchmark_key_prefix --benchmark_filter=olc_db --benchmark_repetitions=9
...
unpredictable_get_shared_length<unodb::olc_db>_pvalue 0.0004 0.0004 U Test, Repetitions: 9 vs 9
unpredictable_get_shared_length<unodb::olc_db>_mean -0.0101 -0.0086 2 2 2 2
unpredictable_leaf_key_prefix_split<unodb::olc_db>_pvalue 0.0004 0.0004 U Test, Repetitions: 9 vs 9
unpredictable_leaf_key_prefix_split<unodb::olc_db>_mean -0.0373 -0.0374 52 50 52 50
unpredictable_cut_key_prefix<unodb::olc_db>_pvalue 0.0004 0.0004 U Test, Repetitions: 9 vs 9
unpredictable_cut_key_prefix<unodb::olc_db>_mean +0.0079 +0.0075 51 52 51 52
unpredictable_prepend_key_prefix<unodb::olc_db>_pvalue 0.0004 0.0004 U Test, Repetitions: 9 vs 9
unpredictable_prepend_key_prefix<unodb::olc_db>_mean -0.0044 -0.0047 63 63 63 63