@thi.ng/bench 3.4.30 → 3.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +12 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -154,6 +154,10 @@ Also see the [formatting](#output-formatting) section below for other output
|
|
|
154
154
|
options. This example uses the default format...
|
|
155
155
|
|
|
156
156
|
```ts
|
|
157
|
+
import { benchmark } from "@thi.ng/bench";
|
|
158
|
+
|
|
159
|
+
// fib() function is from previous example above...
|
|
160
|
+
|
|
157
161
|
benchmark(() => fib(40), { title: "fib", iter: 10, warmup: 5 });
|
|
158
162
|
// benchmarking: fib
|
|
159
163
|
// warmup... 3707.17ms (5 runs)
|
|
@@ -184,14 +188,18 @@ Multiple benchmarks can be run sequentially as suite (also returns an array of
|
|
|
184
188
|
all results):
|
|
185
189
|
|
|
186
190
|
```ts
|
|
187
|
-
|
|
191
|
+
import { suite, FORMAT_MD } from "@thi.ng/bench";
|
|
192
|
+
|
|
193
|
+
// fib2() function defined in earlier example above...
|
|
194
|
+
|
|
195
|
+
suite(
|
|
188
196
|
[
|
|
189
197
|
{ title: "fib2(10)", fn: () => fib2(10) },
|
|
190
198
|
{ title: "fib2(20)", fn: () => fib2(20) },
|
|
191
199
|
{ title: "fib2(30)", fn: () => fib2(30) },
|
|
192
200
|
{ title: "fib2(40)", fn: () => fib2(40) },
|
|
193
201
|
],
|
|
194
|
-
{ iter: 10, size: 100000, warmup: 5, format:
|
|
202
|
+
{ iter: 10, size: 100000, warmup: 5, format: FORMAT_MD }
|
|
195
203
|
)
|
|
196
204
|
|
|
197
205
|
// | Title| Iter| Size| Total| Mean| Median| Min| Max| Q1| Q3| SD%|
|
|
@@ -229,6 +237,8 @@ enabled/disabled, supports recursion and estimates/subtracts its internal
|
|
|
229
237
|
overhead. Results can be obtained as JSON objects or CSV.
|
|
230
238
|
|
|
231
239
|
```ts
|
|
240
|
+
import { Profiler } from "@thi.ng/bench";
|
|
241
|
+
|
|
232
242
|
// initialize with 1million warmup iterations to compute internal overhead (takes around ~100ms)
|
|
233
243
|
const profiler = new Profiler({ warmup: 1e6 });
|
|
234
244
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/bench",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.31",
|
|
4
4
|
"description": "Benchmarking & profiling utilities w/ various statistics & formatters (CSV, JSON, Markdown etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
],
|
|
120
120
|
"year": 2018
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
|
|
123
123
|
}
|