Skip to content

Commit afd74b3

Browse files
authored
Merge pull request #2465 from subspace/remove-single-audit-benchmark
Hide single farmer benchmark behind disabled by default CLI option
2 parents 912aa3b + 4c44d77 commit afd74b3

File tree

1 file changed

+25
-5
lines changed
  • crates/subspace-farmer/src/bin/subspace-farmer/commands

1 file changed

+25
-5
lines changed

crates/subspace-farmer/src/bin/subspace-farmer/commands/benchmark.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ pub(crate) enum BenchmarkArgs {
2424
/// Number of samples to collect for benchmarking purposes
2525
#[arg(long, default_value_t = 10)]
2626
sample_size: usize,
27+
/// Also run `single` benchmark (only useful for developers, not used by default)
28+
#[arg(long)]
29+
with_single: bool,
2730
/// Disk farm to audit
2831
///
2932
/// Example:
@@ -37,6 +40,9 @@ pub(crate) enum BenchmarkArgs {
3740
/// Number of samples to collect for benchmarking purposes
3841
#[arg(long, default_value_t = 10)]
3942
sample_size: usize,
43+
/// Also run `single` benchmark (only useful for developers, not used by default)
44+
#[arg(long)]
45+
with_single: bool,
4046
/// Disk farm to prove
4147
///
4248
/// Example:
@@ -55,19 +61,32 @@ pub(crate) fn benchmark(benchmark_args: BenchmarkArgs) -> anyhow::Result<()> {
5561
match benchmark_args {
5662
BenchmarkArgs::Audit {
5763
sample_size,
64+
with_single,
5865
disk_farm,
5966
filter,
60-
} => audit(sample_size, disk_farm, filter),
67+
} => audit(sample_size, with_single, disk_farm, filter),
6168
BenchmarkArgs::Prove {
6269
sample_size,
70+
with_single,
71+
disk_farm,
72+
filter,
73+
limit_sector_count,
74+
} => prove(
75+
sample_size,
76+
with_single,
6377
disk_farm,
6478
filter,
6579
limit_sector_count,
66-
} => prove(sample_size, disk_farm, filter, limit_sector_count),
80+
),
6781
}
6882
}
6983

70-
fn audit(sample_size: usize, disk_farm: PathBuf, filter: Option<String>) -> anyhow::Result<()> {
84+
fn audit(
85+
sample_size: usize,
86+
with_single: bool,
87+
disk_farm: PathBuf,
88+
filter: Option<String>,
89+
) -> anyhow::Result<()> {
7190
let (single_disk_farm_info, disk_farm) = match SingleDiskFarm::collect_summary(disk_farm) {
7291
SingleDiskFarmSummary::Found { info, directory } => (info, directory),
7392
SingleDiskFarmSummary::NotFound { directory } => {
@@ -107,7 +126,7 @@ fn audit(sample_size: usize, disk_farm: PathBuf, filter: Option<String>) -> anyh
107126
group.throughput(Throughput::Bytes(
108127
sector_size as u64 * sectors_metadata.len() as u64,
109128
));
110-
{
129+
if with_single {
111130
let plot = OpenOptions::new()
112131
.read(true)
113132
.open(disk_farm.join(SingleDiskFarm::PLOT_FILE))
@@ -184,6 +203,7 @@ fn audit(sample_size: usize, disk_farm: PathBuf, filter: Option<String>) -> anyh
184203

185204
fn prove(
186205
sample_size: usize,
206+
with_single: bool,
187207
disk_farm: PathBuf,
188208
filter: Option<String>,
189209
limit_sector_count: Option<usize>,
@@ -226,7 +246,7 @@ fn prove(
226246
}
227247
{
228248
let mut group = criterion.benchmark_group("prove");
229-
{
249+
if with_single {
230250
let plot = OpenOptions::new()
231251
.read(true)
232252
.open(disk_farm.join(SingleDiskFarm::PLOT_FILE))

0 commit comments

Comments
 (0)