diff options
author | Aleksey Kladov <[email protected]> | 2021-02-09 18:52:34 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-02-09 18:52:34 +0000 |
commit | 61f15b72ac52c23148038b3867198597b345e2f6 (patch) | |
tree | 0935428e6e79a42da638a5c983ec526c64f10abb /crates/test_utils/src | |
parent | 4b1279d0b160d98c1429ca1a52b37aa7a0af5775 (diff) |
Add parsing benchmark
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/bench_fixture.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/test_utils/src/bench_fixture.rs b/crates/test_utils/src/bench_fixture.rs index 41fcca635..aa1bea9bb 100644 --- a/crates/test_utils/src/bench_fixture.rs +++ b/crates/test_utils/src/bench_fixture.rs | |||
@@ -1,7 +1,11 @@ | |||
1 | //! Generates large snippets of Rust code for usage in the benchmarks. | 1 | //! Generates large snippets of Rust code for usage in the benchmarks. |
2 | 2 | ||
3 | use std::fs; | ||
4 | |||
3 | use stdx::format_to; | 5 | use stdx::format_to; |
4 | 6 | ||
7 | use crate::project_dir; | ||
8 | |||
5 | pub fn big_struct() -> String { | 9 | pub fn big_struct() -> String { |
6 | let n = 1_000; | 10 | let n = 1_000; |
7 | 11 | ||
@@ -26,3 +30,8 @@ struct S{} {{ | |||
26 | 30 | ||
27 | buf | 31 | buf |
28 | } | 32 | } |
33 | |||
34 | pub fn glorious_old_parser() -> String { | ||
35 | let path = project_dir().join("bench_data/glorious_old_parser"); | ||
36 | fs::read_to_string(&path).unwrap() | ||
37 | } | ||