]> git.proxmox.com Git - rustc.git/blob - vendor/syn/benches/file.rs
08ecd90960248a3c65a47bfde928260bccadb466
[rustc.git] / vendor / syn / benches / file.rs
1 // $ cargo bench --features full --bench file
2
3 #![feature(rustc_private, test)]
4
5 extern crate test;
6
7 #[path = "../tests/repo/mod.rs"]
8 pub mod repo;
9
10 use proc_macro2::TokenStream;
11 use std::fs;
12 use std::str::FromStr;
13 use test::Bencher;
14
15 const FILE: &str = "tests/rust/src/libcore/str/mod.rs";
16
17 #[bench]
18 fn parse_file(b: &mut Bencher) {
19 repo::clone_rust();
20 let content = fs::read_to_string(FILE).unwrap();
21 let tokens = TokenStream::from_str(&content).unwrap();
22 b.iter(|| syn::parse2::<syn::File>(tokens.clone()));
23 }