diff options
Diffstat (limited to 'support/texlab/crates/texlab/benches/bench_main.rs')
-rw-r--r-- | support/texlab/crates/texlab/benches/bench_main.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/support/texlab/crates/texlab/benches/bench_main.rs b/support/texlab/crates/texlab/benches/bench_main.rs index 47b302e313..7fc6d8fc95 100644 --- a/support/texlab/crates/texlab/benches/bench_main.rs +++ b/support/texlab/crates/texlab/benches/bench_main.rs @@ -36,6 +36,41 @@ fn criterion_benchmark(c: &mut Criterion) { ) }); }); + + c.bench_function("BibTeX/Cite", |b| { + let uri1 = Url::parse("http://example.com/texlab.tex").unwrap(); + let uri2 = Url::parse("http://example.com/rht.bib").unwrap(); + let text1 = r#"\cite{a}\addbibresource{rht.bib}"#.to_string(); + let text2 = include_str!("/home/paddy/texlab-testing/rht.bib").to_string(); + let mut workspace = Workspace::default(); + workspace.open( + uri1.clone(), + text1, + Language::Tex, + Owner::Client, + LineCol { line: 0, col: 0 }, + ); + + workspace.open( + uri2.clone(), + text2, + Language::Bib, + Owner::Client, + LineCol { line: 0, col: 6 }, + ); + + let client_capabilities = ClientCapabilities::default(); + + b.iter(|| { + texlab::features::completion::complete( + &workspace, + &uri1, + Position::new(0, 7), + &client_capabilities, + None, + ) + }); + }); } criterion_group!(benches, criterion_benchmark); |