@playcanvas/splat-transform 1.4.0 → 1.4.1
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/dist/cli.mjs +25 -29
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +25 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +25 -29
- package/dist/index.mjs.map +1 -1
- package/dist/lib/data-table/data-table.d.ts +2 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11029,42 +11029,38 @@ class DataTable {
|
|
|
11029
11029
|
* After calling, row `i` will contain the data that was previously at row `indices[i]`.
|
|
11030
11030
|
*
|
|
11031
11031
|
* This is a memory-efficient alternative to `permuteRows` that modifies the table
|
|
11032
|
-
* in-place rather than creating a copy.
|
|
11032
|
+
* in-place rather than creating a copy. It reuses ArrayBuffers between columns to
|
|
11033
|
+
* minimize memory allocations.
|
|
11033
11034
|
*
|
|
11034
11035
|
* @param indices - Array of indices defining the permutation. Must have the same
|
|
11035
11036
|
* length as the number of rows, and must be a valid permutation
|
|
11036
11037
|
* (each index 0 to n-1 appears exactly once).
|
|
11037
11038
|
*/
|
|
11038
11039
|
permuteRowsInPlace(indices) {
|
|
11039
|
-
|
|
11040
|
-
const
|
|
11041
|
-
const
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
// Save values at position i
|
|
11047
|
-
for (let c = 0; c < numCols; c++) {
|
|
11048
|
-
temps[c] = this.columns[c].data[i];
|
|
11040
|
+
// Cache for reusing ArrayBuffers by size
|
|
11041
|
+
const cache = new Map();
|
|
11042
|
+
const getBuffer = (size) => {
|
|
11043
|
+
const cached = cache.get(size);
|
|
11044
|
+
if (cached) {
|
|
11045
|
+
cache.delete(size);
|
|
11046
|
+
return cached;
|
|
11049
11047
|
}
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
for (let c = 0; c < numCols; c++) {
|
|
11064
|
-
this.columns[c].data[j] = this.columns[c].data[next];
|
|
11065
|
-
}
|
|
11066
|
-
j = next;
|
|
11048
|
+
return new ArrayBuffer(size);
|
|
11049
|
+
};
|
|
11050
|
+
const returnBuffer = (buffer) => {
|
|
11051
|
+
cache.set(buffer.byteLength, buffer);
|
|
11052
|
+
};
|
|
11053
|
+
const n = this.numRows;
|
|
11054
|
+
for (const column of this.columns) {
|
|
11055
|
+
const src = column.data;
|
|
11056
|
+
const constructor = src.constructor;
|
|
11057
|
+
const dst = new constructor(getBuffer(src.byteLength));
|
|
11058
|
+
// Sequential writes are cache-friendly
|
|
11059
|
+
for (let i = 0; i < n; i++) {
|
|
11060
|
+
dst[i] = src[indices[i]];
|
|
11067
11061
|
}
|
|
11062
|
+
returnBuffer(src.buffer);
|
|
11063
|
+
column.data = dst;
|
|
11068
11064
|
}
|
|
11069
11065
|
}
|
|
11070
11066
|
}
|
|
@@ -14299,7 +14295,7 @@ class CompressedChunk {
|
|
|
14299
14295
|
}
|
|
14300
14296
|
}
|
|
14301
14297
|
|
|
14302
|
-
var version = "1.4.
|
|
14298
|
+
var version = "1.4.1";
|
|
14303
14299
|
|
|
14304
14300
|
const generatedByString = `Generated by splat-transform ${version}`;
|
|
14305
14301
|
const chunkProps = [
|