mirror of
https://github.com/facebook/sapling.git
synced 2024-12-27 15:13:37 +03:00
dag: limit max segment level to 4
Summary: This is based on fbsource data, building level 5 proves to be not useful. This would save 300ms in the write path. Reviewed By: sfilipco Differential Revision: D23494505 fbshipit-source-id: ca795b4900af40dbfdaa463d36f3169413bf6a62
This commit is contained in:
parent
b4adf0602f
commit
e74133f0fa
@ -72,7 +72,13 @@ pub struct SyncableIdDag<'a, Store: GetLock> {
|
||||
lock: <Store as GetLock>::LockT,
|
||||
}
|
||||
|
||||
static DEFAULT_SEG_SIZE: usize = 16;
|
||||
/// See benches/segment_sizes.rs (D16660078) for this choice.
|
||||
const DEFAULT_SEG_SIZE: usize = 16;
|
||||
|
||||
/// Maximum meaningful level. 4 is chosen because it is good enough
|
||||
/// for an existing large repo (level 5 is not built because it
|
||||
/// cannot merge level 4 segments).
|
||||
const MAX_MEANINGFUL_LEVEL: Level = 4;
|
||||
|
||||
impl IdDag<IndexedLogStore> {
|
||||
/// Open [`IdDag`] at the given directory. Create it on demand.
|
||||
@ -534,6 +540,7 @@ impl<Store: IdDagStore> IdDag<Store> {
|
||||
max_level: Level,
|
||||
) -> Result<usize> {
|
||||
let mut total = 0;
|
||||
let max_level = max_level.min(MAX_MEANINGFUL_LEVEL);
|
||||
for level in 1..=max_level {
|
||||
let count = self.build_high_level_segments(level, drop_last)?;
|
||||
tracing::debug!("new lv{} segments: {}", level, count);
|
||||
|
Loading…
Reference in New Issue
Block a user