@thi.ng/bench 3.1.23 → 3.2.2
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 +8 -1
- package/README.md +12 -5
- package/now.d.ts +3 -3
- package/now.js +9 -5
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-02-10T14:03:10Z
|
|
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,13 @@ 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.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/bench@3.2.0) (2023-02-05)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add support for performance.now() ([f48cb35](https://github.com/thi-ng/umbrella/commit/f48cb35))
|
|
17
|
+
- update now() to add perf.now as primary fallback option
|
|
18
|
+
|
|
12
19
|
## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/bench@3.1.0) (2021-11-17)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -27,12 +27,18 @@ This project is part of the
|
|
|
27
27
|
Benchmarking utilities w/ various statistics & formatters (CSV, Markdown etc.).
|
|
28
28
|
|
|
29
29
|
Though no public API change (only additions), since v2.0.0 this library
|
|
30
|
-
internally
|
|
30
|
+
internally (via
|
|
31
|
+
[`now()`](https://docs.thi.ng/umbrella/bench/functions/now.html)) attempts to
|
|
32
|
+
use high-res ES
|
|
31
33
|
[`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
|
|
32
34
|
timestamps (in Node via
|
|
33
|
-
[`process.hrtime.bigint()`](https://nodejs.org/dist/latest-v12.x/docs/api/process.html#process_process_hrtime_bigint))
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
[`process.hrtime.bigint()`](https://nodejs.org/dist/latest-v12.x/docs/api/process.html#process_process_hrtime_bigint))
|
|
36
|
+
or falls back to `performance.now()` or lacking that to `Date.now()`. In all
|
|
37
|
+
cases, returns a (possibly rounded) nanosec-scale timestamp, either as `bigint`
|
|
38
|
+
or `number`. The
|
|
39
|
+
[`timeDiff()`](https://docs.thi.ng/umbrella/bench/functions/timeDiff.html)
|
|
40
|
+
function can be used to compute the difference between two such timestamp and
|
|
41
|
+
return it as milliseconds.
|
|
36
42
|
|
|
37
43
|
## Status
|
|
38
44
|
|
|
@@ -65,7 +71,7 @@ For Node.js REPL:
|
|
|
65
71
|
const bench = await import("@thi.ng/bench");
|
|
66
72
|
```
|
|
67
73
|
|
|
68
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 1.
|
|
74
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 1.27 KB
|
|
69
75
|
|
|
70
76
|
## Dependencies
|
|
71
77
|
|
|
@@ -82,6 +88,7 @@ A selection:
|
|
|
82
88
|
| Screenshot | Description | Live demo | Source |
|
|
83
89
|
|:--------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------|:--------------------------------------------------------------------------------------|
|
|
84
90
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-knn.jpg" width="240"/> | Doodle w/ K-nearest neighbor search result visualization | [Demo](https://demo.thi.ng/umbrella/geom-knn/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-knn) |
|
|
91
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-knn-hash.jpg" width="240"/> | K-nearest neighbor search in an hash grid | [Demo](https://demo.thi.ng/umbrella/geom-knn-hash/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-knn-hash) |
|
|
85
92
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-voronoi-mst.jpg" width="240"/> | Poisson-disk shape-aware sampling, Voronoi & Minimum Spanning Tree visualization | [Demo](https://demo.thi.ng/umbrella/geom-voronoi-mst/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-voronoi-mst) |
|
|
86
93
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/markdown-parser.jpg" width="240"/> | Minimal Markdown to Hiccup to HTML parser / transformer | [Demo](https://demo.thi.ng/umbrella/markdown/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/markdown) |
|
|
87
94
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/parse-playground.png" width="240"/> | Parser grammar livecoding editor/playground & codegen | [Demo](https://demo.thi.ng/umbrella/parse-playground/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/parse-playground) |
|
package/now.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Fn0, FnU2 } from "@thi.ng/api";
|
|
2
2
|
import type { Timestamp } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* If available, returns wrapper for `process.hrtime.bigint()` else
|
|
5
|
-
*
|
|
6
|
-
* timestamp, either as `bigint` or `number`.
|
|
4
|
+
* If available, returns wrapper for `process.hrtime.bigint()` else falls back
|
|
5
|
+
* to `performance.now()` or lacking that to `Date.now()`. In all cases, returns
|
|
6
|
+
* a nanosec-scale timestamp, either as `bigint` or `number`.
|
|
7
7
|
*/
|
|
8
8
|
export declare const now: Fn0<Timestamp>;
|
|
9
9
|
/**
|
package/now.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* If available, returns wrapper for `process.hrtime.bigint()` else
|
|
3
|
-
*
|
|
4
|
-
* timestamp, either as `bigint` or `number`.
|
|
2
|
+
* If available, returns wrapper for `process.hrtime.bigint()` else falls back
|
|
3
|
+
* to `performance.now()` or lacking that to `Date.now()`. In all cases, returns
|
|
4
|
+
* a nanosec-scale timestamp, either as `bigint` or `number`.
|
|
5
5
|
*/
|
|
6
6
|
export const now = typeof BigInt !== "undefined"
|
|
7
7
|
? typeof process !== "undefined" &&
|
|
8
8
|
typeof process.hrtime !== "undefined" &&
|
|
9
9
|
typeof process.hrtime.bigint === "function"
|
|
10
10
|
? () => process.hrtime.bigint()
|
|
11
|
-
:
|
|
12
|
-
|
|
11
|
+
: typeof performance !== "undefined"
|
|
12
|
+
? () => BigInt(Math.floor(performance.now() * 1e6))
|
|
13
|
+
: () => BigInt(Date.now() * 1e6)
|
|
14
|
+
: typeof performance !== "undefined"
|
|
15
|
+
? () => performance.now() * 1e6
|
|
16
|
+
: () => Date.now() * 1e6;
|
|
13
17
|
/**
|
|
14
18
|
* Returns the difference in milliseconds between 2 given
|
|
15
19
|
* {@link Timestamp}s.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/bench",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Benchmarking utilities w/ various statistics & formatters (CSV, Markdown etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
37
|
+
"@thi.ng/api": "^8.7.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@microsoft/api-extractor": "^7.
|
|
41
|
-
"@thi.ng/testament": "^0.3.
|
|
42
|
-
"@types/node": "^18.11.
|
|
43
|
-
"rimraf": "^
|
|
40
|
+
"@microsoft/api-extractor": "^7.34.2",
|
|
41
|
+
"@thi.ng/testament": "^0.3.11",
|
|
42
|
+
"@types/node": "^18.11.18",
|
|
43
|
+
"rimraf": "^4.1.2",
|
|
44
44
|
"tools": "^0.0.1",
|
|
45
|
-
"typedoc": "^0.23.
|
|
46
|
-
"typescript": "^4.9.
|
|
45
|
+
"typedoc": "^0.23.24",
|
|
46
|
+
"typescript": "^4.9.5"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"benchmark",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
],
|
|
115
115
|
"year": 2018
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "cafa4ecea90fb681949dc3885a5bd6ddefa38b51\n"
|
|
118
118
|
}
|