/
test.rs
47 lines (40 loc) · 1.26 KB
/
test.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
extern crate test;
use std::path::Path;
use super::*;
#[bench]
fn bench_cjs_simple(b: &mut test::Bencher) {
let entry_point = Path::new("examples/simple/index.js");
let input_options = InputOptions::default();
let output = "/dev/null";
let map_output = SourceMapOutput::Inline;
b.iter(|| {
let _ = bundle(&entry_point, input_options, &output, &map_output).unwrap();
});
}
#[bench]
fn bench_es6_simple(b: &mut test::Bencher) {
let entry_point = Path::new("examples/es6-simple/index.mjs");
let input_options = InputOptions {
es6_syntax: true,
..InputOptions::default()
};
let output = "/dev/null";
let map_output = SourceMapOutput::Inline;
b.iter(|| {
let _ = bundle(&entry_point, input_options, &output, &map_output).unwrap();
});
}
#[bench]
fn bench_es6_everywhere_simple(b: &mut test::Bencher) {
let entry_point = Path::new("examples/es6-everywhere-simple/index.js");
let input_options = InputOptions {
es6_syntax: true,
es6_syntax_everywhere: true,
..InputOptions::default()
};
let output = "/dev/null";
let map_output = SourceMapOutput::Inline;
b.iter(|| {
let _ = bundle(&entry_point, input_options, &output, &map_output).unwrap();
});
}