Radix tree: make mt mode a template parameter#1124
Radix tree: make mt mode a template parameter#1124lukaszstolarczuk merged 3 commits intopmem:masterfrom
Conversation
d715969 to
5caab15
Compare
Codecov Report
@@ Coverage Diff @@
## master #1124 +/- ##
==========================================
+ Coverage 94.23% 94.28% +0.05%
==========================================
Files 52 52
Lines 5325 5356 +31
==========================================
+ Hits 5018 5050 +32
+ Misses 307 306 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
KFilipek
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 files at r1.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @igchor)
lukaszstolarczuk
left a comment
There was a problem hiding this comment.
Reviewed 5 of 8 files at r1.
Reviewable status: 7 of 8 files reviewed, 5 unresolved discussions (waiting on @igchor, @KFilipek, and @lukaszstolarczuk)
include/libpmemobj++/experimental/radix_tree.hpp, line 106 at r1 (raw file):
* - erase and clear does not free nodes/leaves immediately, instead they are * added to a garbage list which can be freed by calling garbage_collect() * - insert_or_assign and iterator.assign_val do not perform in-place update,
an in-place update
include/libpmemobj++/experimental/radix_tree.hpp, line 110 at r1 (raw file):
MtMode enables single-writer multiple-readers
what about the default value - then you can have only one thread...? pls extend the description
include/libpmemobj++/experimental/radix_tree.hpp, line 1080 at r1 (raw file):
template <bool Mt, typename Enable> void radix_tree<Key, Value, BytesView, MtMode>::runtime_initialize_mt(ebr *e)
what happens if I call this method with MtMode=false?
include/libpmemobj++/experimental/radix_tree.hpp, line 2193 at r1 (raw file):
template <typename T> void radix_tree<Key, Value, BytesView, MtMode>::free(persistent_ptr<T> ptr)
what about a separate free method for MtMode=false?
tests/radix_tree/radix.hpp, line 34 at r1 (raw file):
using container_inline_s_u8t = nvobjex::radix_tree<nvobjex::basic_inline_string<uint8_t>, nvobjex::basic_inline_string<uint8_t>>;
I know that MtMode is false by default, but pls use, at least once, false explicitly, e.g. here
This allows for better optimization and getting rid of atomic operations in single-threaded workloads.
if !MtMode. This improves performance for single-threaded workloads. After this change performance difference when using MtMode true vs false is ~ 15% for readseq in pmemkv-bench benchmarks for radix.
igchor
left a comment
There was a problem hiding this comment.
Reviewable status: 7 of 8 files reviewed, 5 unresolved discussions (waiting on @KFilipek and @lukaszstolarczuk)
include/libpmemobj++/experimental/radix_tree.hpp, line 106 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
an in-place update
Done.
include/libpmemobj++/experimental/radix_tree.hpp, line 110 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
MtMode enables single-writer multiple-readerswhat about the default value - then you can have only one thread...? pls extend the description
Done.
include/libpmemobj++/experimental/radix_tree.hpp, line 1080 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
what happens if I call this method with
MtMode=false?
You cannot, it won't be compiled (because of this enable_if_
include/libpmemobj++/experimental/radix_tree.hpp, line 2193 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
what about a separate free method for
MtMode=false?
I don't think it's necessary, we need to check for ebr_ ptr anyway at runtime (because if someone called runtime_finalize_mt we cannot use garbage collection, e.g. in dtor).
tests/radix_tree/radix.hpp, line 34 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
I know that
MtModeis false by default, but pls use, at least once,falseexplicitly, e.g. here
Done.
lukaszstolarczuk
left a comment
There was a problem hiding this comment.
Reviewed 3 of 8 files at r1, 2 of 2 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @igchor)
KFilipek
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @igchor)
This change is