@thi.ng/bench 3.4.27 → 3.4.29
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 +7 -1
- package/package.json +4 -4
- package/profiler.d.ts +6 -0
- package/profiler.js +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-02-
|
|
3
|
+
- **Last updated**: 2024-02-25T14:07:53Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [3.4.28](https://github.com/thi-ng/umbrella/tree/@thi.ng/bench@3.4.28) (2024-02-22)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update object destructuring in all pkgs & examples ([f36aeb0](https://github.com/thi-ng/umbrella/commit/f36aeb0))
|
|
17
|
+
|
|
12
18
|
### [3.4.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/bench@3.4.9) (2023-11-09)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/bench",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.29",
|
|
4
4
|
"description": "Benchmarking & profiling utilities w/ various statistics & formatters (CSV, JSON, Markdown etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
38
|
+
"@thi.ng/api": "^8.9.26"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@microsoft/api-extractor": "^7.40.1",
|
|
42
|
-
"@thi.ng/testament": "^0.4.
|
|
42
|
+
"@thi.ng/testament": "^0.4.20",
|
|
43
43
|
"@types/node": "^20.11.17",
|
|
44
44
|
"esbuild": "^0.20.0",
|
|
45
45
|
"rimraf": "^5.0.5",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
],
|
|
120
120
|
"year": 2018
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "6e20f80dd9df1c8055ffa3c1e4d6f7598add0c0b\n"
|
|
123
123
|
}
|
package/profiler.d.ts
CHANGED
|
@@ -104,6 +104,8 @@ export declare class Profiler implements IDeref<IObjectOf<ProfileResult>>, IEnab
|
|
|
104
104
|
*
|
|
105
105
|
* * @example
|
|
106
106
|
* ```ts
|
|
107
|
+
* import { Profiler } from "@thi.ng/bench";
|
|
108
|
+
*
|
|
107
109
|
* const profiler = new Profiler();
|
|
108
110
|
*
|
|
109
111
|
* // recursive function
|
|
@@ -170,6 +172,10 @@ export declare class Profiler implements IDeref<IObjectOf<ProfileResult>>, IEnab
|
|
|
170
172
|
*
|
|
171
173
|
* @example
|
|
172
174
|
* ```ts
|
|
175
|
+
* import { Profiler } from "@thi.ng/bench";
|
|
176
|
+
*
|
|
177
|
+
* const profiler = new Profiler();
|
|
178
|
+
*
|
|
173
179
|
* const sum = profiler.wrap(
|
|
174
180
|
* "sum",
|
|
175
181
|
* (vec: number[]) => vec.reduce((acc, x) => acc + x, 0)
|
package/profiler.js
CHANGED
|
@@ -5,12 +5,8 @@ class Profiler {
|
|
|
5
5
|
_profiles;
|
|
6
6
|
_enabled;
|
|
7
7
|
_overhead = 0;
|
|
8
|
-
constructor(opts) {
|
|
9
|
-
const { warmup, enabled } =
|
|
10
|
-
warmup: 1e6,
|
|
11
|
-
enabled: true,
|
|
12
|
-
...opts
|
|
13
|
-
};
|
|
8
|
+
constructor(opts = {}) {
|
|
9
|
+
const { warmup = 1e6, enabled = true } = opts;
|
|
14
10
|
this.enable();
|
|
15
11
|
if (warmup > 0)
|
|
16
12
|
this.warmup(warmup);
|
|
@@ -99,6 +95,8 @@ class Profiler {
|
|
|
99
95
|
*
|
|
100
96
|
* * @example
|
|
101
97
|
* ```ts
|
|
98
|
+
* import { Profiler } from "@thi.ng/bench";
|
|
99
|
+
*
|
|
102
100
|
* const profiler = new Profiler();
|
|
103
101
|
*
|
|
104
102
|
* // recursive function
|
|
@@ -200,6 +198,10 @@ class Profiler {
|
|
|
200
198
|
*
|
|
201
199
|
* @example
|
|
202
200
|
* ```ts
|
|
201
|
+
* import { Profiler } from "@thi.ng/bench";
|
|
202
|
+
*
|
|
203
|
+
* const profiler = new Profiler();
|
|
204
|
+
*
|
|
203
205
|
* const sum = profiler.wrap(
|
|
204
206
|
* "sum",
|
|
205
207
|
* (vec: number[]) => vec.reduce((acc, x) => acc + x, 0)
|