@thi.ng/random 3.6.0 → 3.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-08-12T13:14:08Z
3
+ - **Last updated**: 2023-08-22T14:39:27Z
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.6.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.1) (2023-08-12)
13
+
14
+ #### ⏱ Performance improvements
15
+
16
+ - add/re-use internal buf for uuid() ([6bf7f1d](https://github.com/thi-ng/umbrella/commit/6bf7f1d))
17
+ - avoid temp allocations (10% faster)
18
+
12
19
  ## [3.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.0) (2023-08-12)
13
20
 
14
21
  #### 🚀 Features
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
9
9
 
10
10
  This project is part of the
11
- [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
11
+ [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and anti-framework.
12
12
 
13
13
  - [About](#about)
14
14
  - [Random distributions](#random-distributions)
@@ -94,7 +94,7 @@ For Node.js REPL:
94
94
  const random = await import("@thi.ng/random");
95
95
  ```
96
96
 
97
- Package sizes (brotli'd, pre-treeshake): ESM: 1.86 KB
97
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.87 KB
98
98
 
99
99
  ## Dependencies
100
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/random",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,14 +34,14 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.9.3",
38
- "@thi.ng/checks": "^3.4.3",
39
- "@thi.ng/errors": "^2.3.3",
40
- "@thi.ng/hex": "^2.3.15"
37
+ "@thi.ng/api": "^8.9.4",
38
+ "@thi.ng/checks": "^3.4.4",
39
+ "@thi.ng/errors": "^2.3.4",
40
+ "@thi.ng/hex": "^2.3.16"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@microsoft/api-extractor": "^7.36.4",
44
- "@thi.ng/testament": "^0.3.21",
44
+ "@thi.ng/testament": "^0.3.22",
45
45
  "rimraf": "^5.0.1",
46
46
  "tools": "^0.0.1",
47
47
  "typedoc": "^0.24.8",
@@ -156,5 +156,5 @@
156
156
  "ksuid"
157
157
  ]
158
158
  },
159
- "gitHead": "399f8c53d66b9b763d16c21bb59f145df5f59514\n"
159
+ "gitHead": "74cfe3fb8de5bfcbfc1109e67604541cbd7b77aa\n"
160
160
  }
package/uuid.js CHANGED
@@ -15,6 +15,8 @@ export const uuidv4Bytes = (buf, rnd) => {
15
15
  buf[8] = 0x80 | (buf[8] & 0x3f);
16
16
  return buf;
17
17
  };
18
+ /** @internal */
19
+ const __buf = new Uint8Array(16);
18
20
  /**
19
21
  * Returns a UUID string, either from given byte array, or if omitted, using a
20
22
  * new UUID v4 produced by {@link uuidv4Bytes}.
@@ -22,4 +24,4 @@ export const uuidv4Bytes = (buf, rnd) => {
22
24
  * @param id - byte array
23
25
  * @param i - start index
24
26
  */
25
- export const uuid = (id, i = 0) => $uuid(id || uuidv4Bytes(), i);
27
+ export const uuid = (id, i = 0) => $uuid(id || uuidv4Bytes(__buf), i);