forked from rrevenantt/antlr4rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperf.rs
53 lines (46 loc) · 1.58 KB
/
perf.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#![feature(try_blocks)]
#![feature(inner_deref)]
#![feature(test)]
#[macro_use]
extern crate lazy_static;
extern crate test;
mod gen {
use test::Bencher;
use antlr_rust::common_token_stream::CommonTokenStream;
use antlr_rust::input_stream::InputStream;
// use crate::gen::perflexer::PerfLexer;
// use crate::gen::perfparser::PerfParser;
// mod perflexer;
// mod perfparser;
// mod perflistener;
// #[cfg(not(debug_assertions))]
// #[test]
// fn performance(){
#[ignore]
// #[bench]
fn performance(b: &mut Bencher) {
// b.iter(|| {
// let lexer = PerfLexer::new(Box::new(InputStream::new(input.to_string())));
// let source = CommonTokenStream::new(lexer);
// let mut parser = PerfParser::new(Box::new(source));
// let result = parser.stat().expect("oops");
// });
}
const input: &str = "\
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4 and
between X1 and X2 or between X3 and X4
;";
}