You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/bench/custom/readme.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,25 @@ In this directory are tests for code paths not covered by our spec or granular (
4
4
5
5
## How to write your own
6
6
7
-
In `benchmarks.mjs` add a new test to an existing array or make a new array for a new subject area.
8
-
Try to fit the name of the function into the format of: "subject area", "method or function" "test case that is being covered" (Ex. `objectid_isvalid_bestcase_false`).
7
+
In `benchmarks.mjs` add a new test to an existing benchmark object or make a new object for a new subject area.
8
+
Try to fit the name of the variables and the benchmark functions into the format of: "subject area", "method or function" "test case that is being covered" (Ex. `objectid_isvalid_bestcase_false`).
9
9
Make sure your test is added to the `benchmarks` export.
10
10
11
11
### Example
12
12
13
13
```js
14
-
constObjectId_isValid= [
15
-
functionobjectid_isvalid_strlen() {
16
-
BSON.ObjectId.isValid('a');
17
-
},
18
-
// ...
19
-
];
20
-
21
-
exportconstbenchmarks= [...ObjectId_isValid];
14
+
constObjectId_isValid= {
15
+
name:'ObjectId_isValid',
16
+
tags: ['objectid'],
17
+
benchmarks : [
18
+
functionobjectid_isvalid_strlen() {
19
+
BSON.ObjectId.isValid('a');
20
+
},
21
+
// ...
22
+
]
23
+
};
24
+
25
+
exportconstbenchmarks= [ObjectId_isValid];
22
26
```
23
27
24
28
## Output
@@ -28,9 +32,9 @@ The JSON emitted at the end of the benchmarks must follow our performance tracki
0 commit comments