Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count perf optimizations. #3

Merged
merged 5 commits into from
Sep 23, 2020
Merged

Count perf optimizations. #3

merged 5 commits into from
Sep 23, 2020

Conversation

tabac
Copy link
Owner

@tabac tabac commented Jul 22, 2020

Performance improvements mostly related to Hyperloglog::count.

Optimizations implemented:

  • Store the number of registers set to zero instead of computing it every time.
  • Refactor HyperloglogPlus::count to avoid computing the Raw Estimate if possible.
  • Precompute an array with all possible values used to calculate the Raw Sum and use it as a lookup table. Requires the const_loop feature available with Rust 1.45.0 or higher.

Results from running the benchmarks first in the master branch and then here with const-loop feature set.

hyperloglog_count_p8    time:   [262.89 ns 267.61 ns 273.36 ns]
                        change: [-67.579% -66.891% -66.241%] (p = 0.00 < 0.05)
                        Performance has improved.          
Found 14 outliers among 100 measurements (14.00%)          
  3 (3.00%) high mild                                      
  11 (11.00%) high severe  
                                                                                                                       
hyperloglog_count_p14   time:   [17.453 us 17.720 us 18.052 us] 
                        change: [-69.500% -68.775% -68.083%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)          
  6 (6.00%) high mild                                      
  8 (8.00%) high severe                                    
                        
hyperloglog_count_p16   time:   [71.786 us 72.865 us 74.142 us]     
                        change: [-68.424% -67.670% -67.017%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)  
  2 (2.00%) low mild                                       
  3 (3.00%) high mild                                      
  2 (2.00%) high severe                                    
                                                                                                                       
hyperloglogplus_count_p8_below_thres                        
                        time:   [29.910 ns 30.472 ns 31.152 ns]               
                        change: [-97.147% -97.084% -97.029%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)       
  2 (2.00%) high mild                                      
  11 (11.00%) high severe                                  
                                                                                                                       
hyperloglogplus_count_p8_above_thres     
                        time:   [293.92 ns 299.70 ns 306.82 ns]               
                        change: [-72.208% -71.519% -70.809%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)          
  3 (3.00%) high mild                                      
  11 (11.00%) high severe                                  

hyperloglogplus_count_p14_below_thres     
                        time:   [30.544 ns 31.067 ns 31.691 ns]
                        change: [-99.955% -99.953% -99.951%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  1 (1.00%) high mild
  8 (8.00%) high severe

hyperloglogplus_count_p14_above_thres                 
                        time:   [18.516 us 18.936 us 19.446 us]
                        change: [-71.074% -70.358% -69.716%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  2 (2.00%) high mild
  8 (8.00%) high severe

hyperloglogplus_count_p16_below_thres 
                        time:   [31.476 ns 32.149 ns 32.964 ns]
                        change: [-99.988% -99.988% -99.987%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe

hyperloglogplus_count_p16_above_thres                       
                        time:   [73.521 us 74.594 us 75.925 us]
                        change: [-70.903% -70.364% -69.858%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  2 (2.00%) high mild
  6 (6.00%) high severe

@tabac tabac force-pushed the count-optimizations branch 2 times, most recently from bc043ab to 5ae3309 Compare August 1, 2020 10:26
@tabac tabac merged commit 826c801 into master Sep 23, 2020
@tabac tabac deleted the count-optimizations branch September 23, 2020 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant