-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbench.js
More file actions
38 lines (33 loc) · 819 Bytes
/
bench.js
File metadata and controls
38 lines (33 loc) · 819 Bytes
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
const {Benchmark} = require("tiny-benchy");
const prettier = require('prettier');
const dprint = require('./');
let input = `
function Example() {
let alertDismiss = (close) => {
close();
alert('Dialog dismissed.');
};
return (
<DialogTrigger isDismissable>
<ActionButton>Info</ActionButton>
{(close) => (
<Dialog onDismiss={() => alertDismiss(close)}>
<Heading>Version Info</Heading>
<Divider />
<Content>
<Text>Version 1.0.0, Copyright 2020</Text>
</Content>
</Dialog>
)}
</DialogTrigger>
);
}
`;
let suite = new Benchmark({iterations: 50});
suite.add('prettier', () => {
prettier.format(input, {parser: 'babel'});
});
suite.add('dprint', () => {
dprint.format('input.js', input);
});
suite.run();