Improve DAC vector performance by using plain bit vectors by default #369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The old version (which compresses slightly better) can still be chosen by using
dac_vector_dp<rrr_vector<>>
. The new version uses plain bit vectors, which has vastly superior query times. Example run:These are the resulting data structure sizes:
random exponential test 9
old = 303961
new (plain) with 1 levels = 290689
new (plain) with 2 levels = 261706
new (plain) with 4 levels = 257820
new (rrr) with 1 levels = 276308
new (rrr) with 2 levels = 252565
new (rrr) with 4 levels = 250591
These are timings:
benchmark size 10000
dac_vector levels 6
dac_vector_dp levels 4
time dac_vector 6746
time dac_vector_dp 2049
time dac_vector_dp<rrr_vector<>> 64340
benchmark size 100000
dac_vector levels 6
dac_vector_dp levels 4
time dac_vector 7959
time dac_vector_dp 2178
time dac_vector_dp<rrr_vector<>> 66496
benchmark size 1000000
dac_vector levels 6
dac_vector_dp levels 4
time dac_vector 10827
time dac_vector_dp 3274
time dac_vector_dp<rrr_vector<>> 65654
benchmark size 10000000
dac_vector levels 6
dac_vector_dp levels 5
time dac_vector 31223
time dac_vector_dp 6775
time dac_vector_dp<rrr_vector<>> 86530