File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ will be excluded from the measurement.
103
103
``` ts
104
104
Deno .bench (" foo" , async (b ) => {
105
105
// Open a file that we will act upon.
106
- const file = await Deno .open (" a_big_data_file.txt" );
106
+ using file = await Deno .open (" a_big_data_file.txt" );
107
107
108
108
// Tell the benchmarking tool that this is the only section you want
109
109
// to measure.
@@ -114,13 +114,12 @@ Deno.bench("foo", async (b) => {
114
114
115
115
// End measurement here.
116
116
b .end ();
117
-
118
- // Now we can perform some potentially time-consuming teardown that will not
119
- // taint out benchmark results.
120
- file .close ();
121
117
});
122
118
```
123
119
120
+ The above example requires the ` --allow-read ` flag to run the benchmark:
121
+ ` deno bench --allow-read file_reading.ts ` .
122
+
124
123
## Grouping and baselines
125
124
126
125
When registering a bench case, it can be assigned to a group, using
You can’t perform that action at this time.
0 commit comments