-
Notifications
You must be signed in to change notification settings - Fork 10
/
benches.rs
232 lines (197 loc) · 6.55 KB
/
benches.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
use criterion::{criterion_group, criterion_main, Criterion};
use once_cell::sync::Lazy;
use ratatui::{backend::TestBackend, Terminal};
use tui_term::widget::PseudoTerminal;
use vt100::Screen;
static SIMPLE_LS_ACTIONS: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/simple_ls.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_01: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_01.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_02: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_02.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_03: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_03.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_04: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_04.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_05: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_05.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_06: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_06.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_07: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_07.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_08: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_08.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_09: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_09.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_10: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_10.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_11: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_11.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_12: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_12.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_13: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_13.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_14: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_14.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
static VTTEST_02_15: Lazy<Screen> = Lazy::new(|| {
let stream = include_bytes!("../test/typescript/vttest_02_15.typescript");
let mut parser = vt100::Parser::new(24, 80, 0);
parser.process(stream);
parser.screen().clone()
});
#[inline]
fn render_typescript(screen: &Screen) {
let backend = TestBackend::new(80, 24);
let mut terminal = Terminal::new(backend).unwrap();
let pseudo_term = PseudoTerminal::new(screen);
terminal
.draw(|f| {
f.render_widget(pseudo_term, f.area());
})
.unwrap();
let _view = terminal.backend().to_string();
}
#[inline]
fn simple_ls() {
render_typescript(&SIMPLE_LS_ACTIONS)
}
#[inline]
fn vttest_02_01() {
render_typescript(&VTTEST_02_01)
}
#[inline]
fn vttest_02_02() {
render_typescript(&VTTEST_02_02)
}
#[inline]
fn vttest_02_03() {
render_typescript(&VTTEST_02_03)
}
#[inline]
fn vttest_02_04() {
render_typescript(&VTTEST_02_04)
}
#[inline]
fn vttest_02_05() {
render_typescript(&VTTEST_02_05)
}
#[inline]
fn vttest_02_06() {
render_typescript(&VTTEST_02_06)
}
#[inline]
fn vttest_02_07() {
render_typescript(&VTTEST_02_07)
}
#[inline]
fn vttest_02_08() {
render_typescript(&VTTEST_02_08)
}
#[inline]
fn vttest_02_09() {
render_typescript(&VTTEST_02_09)
}
#[inline]
fn vttest_02_10() {
render_typescript(&VTTEST_02_10)
}
#[inline]
fn vttest_02_11() {
render_typescript(&VTTEST_02_11)
}
#[inline]
fn vttest_02_12() {
render_typescript(&VTTEST_02_12)
}
#[inline]
fn vttest_02_13() {
render_typescript(&VTTEST_02_13)
}
#[inline]
fn vttest_02_14() {
render_typescript(&VTTEST_02_14)
}
#[inline]
fn vttest_02_15() {
render_typescript(&VTTEST_02_15)
}
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("simple ls", |b| b.iter(simple_ls));
c.bench_function("vttest_02_01", |b| b.iter(vttest_02_01));
c.bench_function("vttest_02_02", |b| b.iter(vttest_02_02));
c.bench_function("vttest_02_03", |b| b.iter(vttest_02_03));
c.bench_function("vttest_02_04", |b| b.iter(vttest_02_04));
c.bench_function("vttest_02_05", |b| b.iter(vttest_02_05));
c.bench_function("vttest_02_06", |b| b.iter(vttest_02_06));
c.bench_function("vttest_02_07", |b| b.iter(vttest_02_07));
c.bench_function("vttest_02_08", |b| b.iter(vttest_02_08));
c.bench_function("vttest_02_09", |b| b.iter(vttest_02_09));
c.bench_function("vttest_02_10", |b| b.iter(vttest_02_10));
c.bench_function("vttest_02_11", |b| b.iter(vttest_02_11));
c.bench_function("vttest_02_12", |b| b.iter(vttest_02_12));
c.bench_function("vttest_02_13", |b| b.iter(vttest_02_13));
c.bench_function("vttest_02_14", |b| b.iter(vttest_02_14));
c.bench_function("vttest_02_15", |b| b.iter(vttest_02_15));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);