Skip to content
  • Andrew Kryczka's avatar
    save a key comparison in block seeks (#6646) · e6be168a
    Andrew Kryczka authored
    Summary:
    This saves up to two key comparisons in block seeks. The first key
    comparison saved is a redundant key comparison against the restart key
    where the linear scan starts. This comparison is saved in all cases
    except when the found key is in the first restart interval. The
    second key comparison saved is a redundant key comparison against the
    restart key where the linear scan ends. This is only saved in cases
    where all keys in the restart interval are less than the target
    (probability roughly `1/restart_interval`).
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/6646
    
    Test Plan:
    ran a benchmark with mostly default settings and counted key comparisons
    
    before: `user_key_comparison_count = 19399529`
    after: `user_key_comparison_count = 18431498`
    
    setup command:
    
    ```
    $ TEST_TMPDIR=/dev/shm/dbbench ./db_bench -benchmarks=fillrandom,compact -write_buffer_size=1048576 -target_file_size_base=1048576 -max_bytes_for_level_base=4194304 -max_background_jobs=12 -level_compaction_dynamic_level_bytes=true -num=10000000
    ```
    
    benchmark command:
    
    ```
    $ TEST_TMPDIR=/dev/shm/dbbench/ ./db_bench -use_existing_db=true -benchmarks=readrandom -disable_auto_compactions=true -num=10000000 -compression_type=none -reads=1000000 -perf_level=3
    ```
    
    Reviewed By: pdillinger
    
    Differential Revision: D20849707
    
    Pulled By: ajkr
    
    fbshipit-source-id: 1f01c5cd99ea771fd27974046e37b194f1cdcfac
    e6be168a
To find the state of this project's repository at the time of any of these versions, check out the tags.