Skip to content

Commit

Permalink
perf: extend the benchmark for better resolving checks
Browse files Browse the repository at this point in the history
The current schema generated for benchmarks on large schemas didn't
generate any definitions that use type references. Therefore, the
benchmark didn't give good insight on type resolution timing.
  • Loading branch information
dnaka91 committed Oct 29, 2023
1 parent 2b518ab commit 2074449
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/stef-benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,20 @@ pub fn generate_schema(count: usize) -> String {
writeln!(&mut input, "type Alias{i} = SampleNamed;").unwrap();
}

input.push_str("\nmod resolve {\n");
writeln!(&mut input, " struct Sample {{").unwrap();
for i in 1..=count {
writeln!(&mut input, " field{i:05}: Type{i:05} @{i},").unwrap();
}
writeln!(&mut input, " }}").unwrap();
for i in 1..=count {
writeln!(&mut input, " struct Type{i:05} {{").unwrap();
writeln!(&mut input, " value1: string @1,").unwrap();
writeln!(&mut input, " value2: i64 @2,").unwrap();
writeln!(&mut input, " value3: u64 @3,").unwrap();
writeln!(&mut input, " }}").unwrap();
}
input.push_str("}\n");

input
}

0 comments on commit 2074449

Please sign in to comment.