Skip to content

Commit 8e20d20

Browse files
giorgidzemeta-codesync[bot]
authored andcommitted
Define the traversal progress update interval as constant
Summary: This diff defines the traversal progress update interval as a constant, allowing for easier maintenance and modification in the future. The constant `TRAVERSAL_PROGRESS_UPDATE_INTERVAL` is defined in `types.rs` and is set to 10,000. Changed the value from 1000 to 10000 because we see traversal speeds now at around 30k files/s and 1000 value was resulting into too frequent progress bar updates. Reviewed By: akushner Differential Revision: D83895166 fbshipit-source-id: 268361376193daa797d90da6b344597e854c22fb
1 parent 9aeca9d commit 8e20d20

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

eden/fs/cli_rs/edenfs-commands/src/debug/bench/traversal.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,18 @@ impl InProgressTraversal {
110110
fn add_file(&mut self, path: PathBuf) {
111111
self.file_count += 1;
112112
self.file_paths.push(path);
113-
if (self.file_count + self.dir_count).is_multiple_of(1000) {
113+
if (self.file_count + self.dir_count)
114+
.is_multiple_of(types::TRAVERSAL_PROGRESS_UPDATE_INTERVAL)
115+
{
114116
self.update_progress();
115117
}
116118
}
117119

118120
fn add_dir(&mut self) {
119121
self.dir_count += 1;
120-
if (self.file_count + self.dir_count).is_multiple_of(1000) {
122+
if (self.file_count + self.dir_count)
123+
.is_multiple_of(types::TRAVERSAL_PROGRESS_UPDATE_INTERVAL)
124+
{
121125
self.update_progress();
122126
}
123127
}

eden/fs/cli_rs/edenfs-commands/src/debug/bench/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub const NUMBER_OF_SUB_DIRS: usize = 256;
2222
pub const BYTES_IN_KILOBYTE: usize = 1024;
2323
pub const BYTES_IN_MEGABYTE: usize = 1024 * BYTES_IN_KILOBYTE;
2424
pub const BYTES_IN_GIGABYTE: usize = 1024 * BYTES_IN_MEGABYTE;
25+
pub const TRAVERSAL_PROGRESS_UPDATE_INTERVAL: usize = 10000;
2526

2627
/// Represents the type of benchmark being performed
2728
#[derive(Debug, Clone, Serialize)]

0 commit comments

Comments
 (0)