Skip to content

Commit

Permalink
Add iai benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Feb 6, 2021
1 parent 43476cf commit 0b8a01a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fluent-syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ all-benchmarks = []
name = "parser"
harness = false

[[bench]]
name = "parser_iai"
harness = false

[[bin]]
name = "parser"
path = "src/bin/parser.rs"
Expand Down
15 changes: 15 additions & 0 deletions fluent-syntax/benches/parser_iai.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use fluent_syntax::parser::parse_runtime;

fn iai_parse_ctx_runtime() {
let files = &[
include_str!("contexts/browser/appmenu.ftl"),
include_str!("contexts/browser/browser.ftl"),
include_str!("contexts/browser/menubar.ftl"),
include_str!("contexts/preferences/preferences.ftl"),
];
for source in files {
parse_runtime(*source).expect("Parsing of the FTL failed.");
}
}

iai::main!(iai_parse_ctx_runtime);

0 comments on commit 0b8a01a

Please sign in to comment.