@nxtedition/slice
Advanced tools
+2
-1
@@ -27,3 +27,4 @@ import util from 'node:util'; | ||
| constructor(poolTotal?: number); | ||
| isFromPool(slice: Slice): boolean; | ||
| get size(): number; | ||
| isFromPool(slice: Slice | null | undefined): boolean; | ||
| realloc(slice: Slice, byteLength: number): Slice; | ||
@@ -30,0 +31,0 @@ get stats(): { |
+11
-7
@@ -226,2 +226,3 @@ import util from 'node:util' | ||
| #size = 0 | ||
| #padding = 0 | ||
@@ -233,3 +234,2 @@ #pools = [] | ||
| #poolCount = 0 | ||
| #padding = 0 | ||
@@ -243,3 +243,7 @@ constructor(poolTotal = 128 * 1024 * 1024) { | ||
| isFromPool(slice ) { | ||
| get size() { | ||
| return this.#size | ||
| } | ||
| isFromPool(slice ) { | ||
| return slice != null && slice.buffer === this.#poolBuffer | ||
@@ -260,3 +264,3 @@ } | ||
| if (this.isFromPool(slice)) { | ||
| if (slice != null && slice.buffer === this.#poolBuffer) { | ||
| const srcIdx = 32 - Math.clz32(slice.maxByteLength - 1) | ||
@@ -268,3 +272,3 @@ | ||
| this.#size -= slice.byteLength | ||
| this.#size -= slice.maxByteLength | ||
| this.#padding -= slice.maxByteLength - slice.byteLength | ||
@@ -274,3 +278,3 @@ | ||
| slice.byteLength = byteLength | ||
| this.#size += slice.byteLength | ||
| this.#size += slice.maxByteLength | ||
| this.#padding += slice.maxByteLength - slice.byteLength | ||
@@ -321,3 +325,3 @@ return slice | ||
| this.#size += slice.byteLength | ||
| this.#size += slice.maxByteLength | ||
| this.#padding += slice.maxByteLength - slice.byteLength | ||
@@ -332,3 +336,3 @@ | ||
| padding: this.#padding, | ||
| ratio: this.#size > 0 ? (this.#size + this.#padding) / this.#size : 1, | ||
| ratio: this.#size > 0 ? this.#size / (this.#size - this.#padding) : 1, | ||
| poolTotal: this.#poolBuffer.byteLength, | ||
@@ -335,0 +339,0 @@ poolUsed: this.#poolOffset, |
+3
-2
| { | ||
| "name": "@nxtedition/slice", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "type": "module", | ||
@@ -22,3 +22,4 @@ "main": "lib/index.js", | ||
| "typescript": "^5.9.3" | ||
| } | ||
| }, | ||
| "gitHead": "a798a1529b93f64e8dd82ccc8c23579c231afdbd" | ||
| } |
Explicitly Unlicensed Item
LicenseSomething was found which is explicitly marked as unlicensed.
Explicitly Unlicensed Item
LicenseSomething was found which is explicitly marked as unlicensed.
10576
2%316
1.28%