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
Check out the [documentation](https://docs.codspeed.io/benchmarks/nodejs) for complete integration instructions.
15
+
16
+
## Installation
17
+
18
+
First install the plugin [`@codspeed/benchmark.js-plugin`](https://www.npmjs.com/package/@codspeed/tinybench-plugin) and `benchmark.js` (if not already installed):
- We create a simple recursive fibonacci function.
69
+
- We create a new `Benchmark.Suite` instance with CodSpeed support by using the **`withCodSpeed`** helper. This step is **critical** to enable CodSpeed on your benchmarks.
70
+
- We add two benchmarks to the suite and launch it, benching our `fibonacci` function with 10 and 15.
71
+
72
+
Now, we can run our benchmarks locally to make sure everything is working as expected:
73
+
74
+
```sh
75
+
$ node benches/bench.mjs
76
+
[CodSpeed] 2 benches detected but no instrumentation found
77
+
[CodSpeed] falling back to benchmark.js
78
+
79
+
fibonacci10 x 2,155,187 ops/sec ±0.50% (96 runs sampled)
80
+
fibonacci15 x 194,742 ops/sec ±0.48% (95 runs sampled)
81
+
```
82
+
83
+
And... Congrats🎉, CodSpeed is installed in your benchmarking suite! Locally, CodSpeed will fallback to tinybench since the instrumentation is only available in the CI environment for now.
84
+
85
+
You can now [run those benchmark in your CI](https://docs.codspeed.io/benchmarks/nodejs#running-the-benchmarks-in-your-ci) to continuously get consistent performance measurements.
Check out the [documentation](https://docs.codspeed.io/benchmarks/nodejs) for complete integration instructions.
15
+
16
+
## Installation
17
+
18
+
First install the plugin [`@codspeed/tinybench-plugin`](https://www.npmjs.com/package/@codspeed/tinybench-plugin) and `tinybench` (if not already installed):
- We create a simple recursive fibonacci function.
73
+
- We create a new `Bench` instance with CodSpeed support by using the **`withCodSpeed`** helper. This step is **critical** to enable CodSpeed on your benchmarks.
74
+
75
+
- We add two benchmarks to the suite and launch it, benching our `fibonacci` function for 10 and 15.
76
+
77
+
Now, we can run our benchmarks locally to make sure everything is working as expected:
78
+
79
+
```sh
80
+
$ node benches/bench.mjs
81
+
[CodSpeed] 2 benches detected but no instrumentation found
82
+
[CodSpeed] falling back to tinybench
83
+
84
+
┌─────────┬───────────────┬────────────────────┐
85
+
│ (index) │ Task Name │ Average Time (ps) │
86
+
├─────────┼───────────────┼────────────────────┤
87
+
│ 0 │ 'fibonacci10' │ 0.5660083779532603 │
88
+
│ 1 │ 'fibonacci15' │ 5.2475729101797635 │
89
+
└─────────┴───────────────┴────────────────────┘
90
+
```
91
+
92
+
And... Congrats🎉, CodSpeed is installed in your benchmarking suite! Locally, CodSpeed will fallback to tinybench since the instrumentation is only available in the CI environment for now.
93
+
94
+
You can now [run those benchmark in your CI](https://docs.codspeed.io/benchmarks/nodejs#running-the-benchmarks-in-your-ci) to continuously get consistent performance measurements.
0 commit comments