Skip to content

Commit

Permalink
feat(compiler): introduce a simplified schema for easier codegen
Browse files Browse the repository at this point in the history
The parser's data structures can be a bit hard to use in the code
generator, and some upcoming features would need to be rebuilt in every
code generator.

By introducing a simplified version of the schema data structures,
common conversion logic can be moved into the compiler and overall make
the data structures more convenient to use.
  • Loading branch information
dnaka91 committed Dec 28, 2023
1 parent 5b79acb commit 131e7b4
Show file tree
Hide file tree
Showing 53 changed files with 2,080 additions and 1,966 deletions.
45 changes: 45 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions crates/stef-benches/benches/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ fn resolve_large_schema<const N: usize>(bencher: Bencher<'_, '_>) {

bencher.bench(|| stef_compiler::resolve_schemas(black_box(list)));
}

#[divan::bench(consts = [1, 10, 100, 1000])]
fn simplify_large_schema<const N: usize>(bencher: Bencher<'_, '_>) {
let schema = stef_benches::generate_schema(N);
let schema = stef_parser::Schema::parse(&schema, None).unwrap();
let _ = stef_compiler::simplify_schema(&schema);

bencher.bench(|| stef_compiler::simplify_schema(black_box(&schema)));
}
Loading

0 comments on commit 131e7b4

Please sign in to comment.