@fluidframework/matrix 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.0
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/.eslintrc.js +20 -21
- package/.mocharc.js +2 -2
- package/README.md +21 -21
- package/api-extractor.json +2 -2
- package/bench/bsp-set-optimizations.md +5 -5
- package/bench/src/index.ts +38 -20
- package/bench/src/read/map.ts +16 -10
- package/bench/src/read/nativearray.ts +16 -10
- package/bench/src/read/test.ts +17 -19
- package/bench/src/read/tiled.ts +240 -181
- package/bench/src/util.ts +19 -18
- package/bench/tsconfig.json +8 -13
- package/dist/bspSet.d.ts.map +1 -1
- package/dist/bspSet.js.map +1 -1
- package/dist/handlecache.d.ts.map +1 -1
- package/dist/handlecache.js +1 -3
- package/dist/handlecache.js.map +1 -1
- package/dist/handletable.d.ts.map +1 -1
- package/dist/handletable.js +7 -3
- package/dist/handletable.js.map +1 -1
- package/dist/matrix.d.ts +1 -1
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +28 -19
- package/dist/matrix.js.map +1 -1
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/permutationvector.d.ts.map +1 -1
- package/dist/permutationvector.js +15 -8
- package/dist/permutationvector.js.map +1 -1
- package/dist/productSet.d.ts.map +1 -1
- package/dist/productSet.js +6 -3
- package/dist/productSet.js.map +1 -1
- package/dist/range.d.ts.map +1 -1
- package/dist/range.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js.map +1 -1
- package/dist/sparsearray2d.d.ts.map +1 -1
- package/dist/sparsearray2d.js +12 -12
- package/dist/sparsearray2d.js.map +1 -1
- package/dist/split.d.ts.map +1 -1
- package/dist/split.js +5 -3
- package/dist/split.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/undoprovider.d.ts.map +1 -1
- package/dist/undoprovider.js.map +1 -1
- package/lib/bspSet.d.ts.map +1 -1
- package/lib/bspSet.js.map +1 -1
- package/lib/handlecache.d.ts.map +1 -1
- package/lib/handlecache.js +1 -3
- package/lib/handlecache.js.map +1 -1
- package/lib/handletable.d.ts.map +1 -1
- package/lib/handletable.js +7 -3
- package/lib/handletable.js.map +1 -1
- package/lib/matrix.d.ts +1 -1
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +29 -20
- package/lib/matrix.js.map +1 -1
- package/lib/ops.d.ts.map +1 -1
- package/lib/ops.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/permutationvector.d.ts.map +1 -1
- package/lib/permutationvector.js +15 -8
- package/lib/permutationvector.js.map +1 -1
- package/lib/productSet.d.ts.map +1 -1
- package/lib/productSet.js +6 -3
- package/lib/productSet.js.map +1 -1
- package/lib/range.d.ts.map +1 -1
- package/lib/range.js.map +1 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js.map +1 -1
- package/lib/serialization.d.ts.map +1 -1
- package/lib/serialization.js.map +1 -1
- package/lib/sparsearray2d.d.ts.map +1 -1
- package/lib/sparsearray2d.js +12 -12
- package/lib/sparsearray2d.js.map +1 -1
- package/lib/split.d.ts.map +1 -1
- package/lib/split.js +5 -3
- package/lib/split.js.map +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/undoprovider.d.ts.map +1 -1
- package/lib/undoprovider.js +1 -1
- package/lib/undoprovider.js.map +1 -1
- package/package.json +117 -116
- package/prettier.config.cjs +1 -1
- package/src/bspSet.ts +507 -434
- package/src/handlecache.ts +114 -112
- package/src/handletable.ts +66 -62
- package/src/matrix.ts +781 -710
- package/src/ops.ts +11 -11
- package/src/packageVersion.ts +1 -1
- package/src/permutationvector.ts +425 -368
- package/src/productSet.ts +852 -788
- package/src/range.ts +8 -8
- package/src/runtime.ts +35 -35
- package/src/serialization.ts +13 -9
- package/src/sparsearray2d.ts +196 -192
- package/src/split.ts +111 -90
- package/src/types.ts +3 -3
- package/src/undoprovider.ts +161 -144
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
package/bench/src/read/tiled.ts
CHANGED
|
@@ -6,201 +6,254 @@
|
|
|
6
6
|
import { pointwise } from "./test";
|
|
7
7
|
|
|
8
8
|
const enum Consts {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
logW = 4,
|
|
10
|
+
logH = 5,
|
|
11
|
+
w = 1 << logW,
|
|
12
|
+
h = 1 << logH,
|
|
13
|
+
mw = w - 1,
|
|
14
|
+
mh = h - 1,
|
|
15
|
+
sizeW = 1 << (4 * logW),
|
|
16
|
+
sizeH = 1 << (4 * logH),
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
type CellTile<T> = T[]
|
|
19
|
+
type CellTile<T> = T[];
|
|
20
20
|
|
|
21
21
|
type SparseGrid<T> = CellTile<T>[][][];
|
|
22
22
|
|
|
23
23
|
function getCell<T>(r: number, c: number, grid: SparseGrid<T>): T | undefined {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
if (r < 0 || c < 0 || r >= Consts.sizeH || c >= Consts.sizeW) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const t2 =
|
|
28
|
+
grid[
|
|
29
|
+
(((c >> (3 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
30
|
+
((r >> (3 * Consts.logH)) & Consts.mh)
|
|
31
|
+
];
|
|
32
|
+
if (t2) {
|
|
33
|
+
const t3 =
|
|
34
|
+
t2[
|
|
35
|
+
(((c >> (2 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
36
|
+
((r >> (2 * Consts.logH)) & Consts.mh)
|
|
37
|
+
];
|
|
38
|
+
if (t3) {
|
|
39
|
+
const t4 =
|
|
40
|
+
t3[
|
|
41
|
+
(((c >> Consts.logW) & Consts.mw) << Consts.logH) |
|
|
42
|
+
((r >> Consts.logH) & Consts.mh)
|
|
43
|
+
];
|
|
44
|
+
if (t4) {
|
|
45
|
+
return t4[((c & Consts.mw) << Consts.logH) | (r & Consts.mh)];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
function setCell<T>(r: number, c: number, grid: SparseGrid<T>, value: T) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
if (r < 0 || c < 0 || r >= Consts.sizeH || c >= Consts.sizeW) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const i2 =
|
|
58
|
+
(((c >> (3 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
59
|
+
((r >> (3 * Consts.logH)) & Consts.mh);
|
|
60
|
+
let t2 = grid[i2];
|
|
61
|
+
if (t2 === undefined) {
|
|
62
|
+
t2 = grid[i2] = [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const i3 =
|
|
66
|
+
(((c >> (2 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
67
|
+
((r >> (2 * Consts.logH)) & Consts.mh);
|
|
68
|
+
let t3 = t2[i3];
|
|
69
|
+
if (t3 === undefined) {
|
|
70
|
+
t3 = t2[i3] = [];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const i4 = (((c >> Consts.logW) & Consts.mw) << Consts.logH) | ((r >> Consts.logH) & Consts.mh);
|
|
74
|
+
let t4 = t3[i4];
|
|
75
|
+
if (t4 === undefined) {
|
|
76
|
+
t4 = t3[i4] = [];
|
|
77
|
+
}
|
|
78
|
+
t4[((c & Consts.mw) << Consts.logH) | (r & Consts.mh)] = value;
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
function clearCell<T>(r: number, c: number, grid: SparseGrid<T>) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
if (r < 0 || c < 0 || r >= Consts.sizeH || c >= Consts.sizeW) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const i2 =
|
|
87
|
+
(((c >> (3 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
88
|
+
((r >> (3 * Consts.logH)) & Consts.mh);
|
|
89
|
+
const t2 = grid[i2];
|
|
90
|
+
if (t2 === undefined) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const i3 =
|
|
95
|
+
(((c >> (2 * Consts.logW)) & Consts.mw) << Consts.logH) |
|
|
96
|
+
((r >> (2 * Consts.logH)) & Consts.mh);
|
|
97
|
+
const t3 = t2[i3];
|
|
98
|
+
if (t3 === undefined) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const i4 = (((c >> Consts.logW) & Consts.mw) << Consts.logH) | ((r >> Consts.logH) & Consts.mh);
|
|
103
|
+
const t4 = t3[i4];
|
|
104
|
+
if (t4 === undefined) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
delete t4[((c & Consts.mw) << Consts.logH) | (r & Consts.mh)];
|
|
88
108
|
}
|
|
89
109
|
|
|
90
110
|
function forEachCell<T>(grid: SparseGrid<T>, cb: (r: number, c: number, value: T) => void): void {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
let i1 = 0;
|
|
112
|
+
for (const t1 of grid) {
|
|
113
|
+
if (t1 !== undefined) {
|
|
114
|
+
let i2 = 0;
|
|
115
|
+
const c1 = (i1 >> Consts.logH) << (3 * Consts.logW);
|
|
116
|
+
const r1 = (i1 & Consts.mh) << (3 * Consts.logH);
|
|
117
|
+
for (const t2 of t1) {
|
|
118
|
+
if (t2 !== undefined) {
|
|
119
|
+
let i3 = 0;
|
|
120
|
+
const c2 = (i2 >> Consts.logH) << (2 * Consts.logW);
|
|
121
|
+
const r2 = (i2 & Consts.mh) << (2 * Consts.logH);
|
|
122
|
+
for (const t3 of t2) {
|
|
123
|
+
if (t3 !== undefined) {
|
|
124
|
+
let i4 = 0;
|
|
125
|
+
const c3 = (i3 >> Consts.logH) << Consts.logW;
|
|
126
|
+
const r3 = (i3 & Consts.mh) << Consts.logH;
|
|
127
|
+
for (const value of t3) {
|
|
128
|
+
if (value !== undefined) {
|
|
129
|
+
cb(
|
|
130
|
+
r1 | r2 | r3 | (i4 & Consts.mh),
|
|
131
|
+
c1 | c2 | c3 | (i4 >> Consts.logH),
|
|
132
|
+
value,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
i4++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
i3++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
i2++;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
i1++;
|
|
145
|
+
}
|
|
122
146
|
}
|
|
123
147
|
|
|
124
|
-
function forEachCellInColumn<T>(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
function forEachCellInColumn<T>(
|
|
149
|
+
grid: SparseGrid<T>,
|
|
150
|
+
column: number,
|
|
151
|
+
cb: (r: number, c: number, value: T) => void,
|
|
152
|
+
): void {
|
|
153
|
+
const colIdx1 = colIdx(column, 3);
|
|
154
|
+
const colIdx2 = colIdx(column, 2);
|
|
155
|
+
const colIdx3 = colIdx(column, 1);
|
|
156
|
+
const colIdx4 = colIdx(column, 0);
|
|
157
|
+
for (let r1 = 0; r1 < Consts.h; r1++) {
|
|
158
|
+
const t1 = grid[colIdx1 | r1];
|
|
159
|
+
if (t1 === undefined) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
for (let r2 = 0; r2 < Consts.h; r2++) {
|
|
163
|
+
const t2 = t1[colIdx2 | r2];
|
|
164
|
+
if (t2 === undefined) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
for (let r3 = 0; r3 < Consts.h; r3++) {
|
|
168
|
+
const t3 = t2[colIdx3 | r3];
|
|
169
|
+
if (t3 === undefined) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
for (let r4 = 0; r4 < Consts.h; r4++) {
|
|
173
|
+
const cell = t3[colIdx4 | r4];
|
|
174
|
+
if (cell === undefined) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
cb(
|
|
178
|
+
((r1 & Consts.mh) << (3 * Consts.logH)) |
|
|
179
|
+
((r2 & Consts.mh) << (2 * Consts.logH)) |
|
|
180
|
+
((r3 & Consts.mh) << Consts.logH) |
|
|
181
|
+
(r4 & Consts.mh),
|
|
182
|
+
column,
|
|
183
|
+
cell as any,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
152
189
|
}
|
|
153
190
|
|
|
154
191
|
function colIdx(col: number, level: 0 | 1 | 2 | 3): number {
|
|
155
|
-
|
|
192
|
+
return ((col >> (level * Consts.logW)) & Consts.mw) << Consts.logH;
|
|
156
193
|
}
|
|
157
194
|
|
|
158
195
|
function colIdxUnshifted(col: number, level: 0 | 1 | 2 | 3): number {
|
|
159
|
-
|
|
196
|
+
return (col >> (level * Consts.logW)) & Consts.mw;
|
|
160
197
|
}
|
|
161
198
|
|
|
162
|
-
function forEachCellInColumns<T>(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
function forEachCellInColumns<T>(
|
|
200
|
+
grid: SparseGrid<T>,
|
|
201
|
+
columnStart: number,
|
|
202
|
+
numCols: number,
|
|
203
|
+
cb: (r: number, c: number, value: T) => void,
|
|
204
|
+
): void {
|
|
205
|
+
const colEnd = columnStart + numCols - 1;
|
|
206
|
+
for (let r1 = 0; r1 < Consts.h; r1++) {
|
|
207
|
+
const cStart1 = colIdxUnshifted(columnStart, 3);
|
|
208
|
+
const cEnd1 = colIdxUnshifted(colEnd, 3);
|
|
209
|
+
for (let c1 = cStart1; c1 <= cEnd1; c1++) {
|
|
210
|
+
const t1 = grid[(c1 << Consts.logH) | r1];
|
|
211
|
+
if (t1 === undefined) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
for (let r2 = 0; r2 < Consts.h; r2++) {
|
|
215
|
+
const cStart2 = colIdxUnshifted(columnStart, 2);
|
|
216
|
+
const cEnd2 = colIdxUnshifted(colEnd, 2);
|
|
217
|
+
for (let c2 = cStart2; c2 <= cEnd2; c2++) {
|
|
218
|
+
const t2 = t1[(c2 << Consts.logH) | r2];
|
|
219
|
+
if (t2 === undefined) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
for (let r3 = 0; r3 < Consts.h; r3++) {
|
|
223
|
+
const cStart3 = colIdxUnshifted(columnStart, 1);
|
|
224
|
+
const cEnd3 = colIdxUnshifted(colEnd, 1);
|
|
225
|
+
for (let c3 = cStart3; c3 <= cEnd3; c3++) {
|
|
226
|
+
const t3 = t2[(c3 << Consts.logH) | r3];
|
|
227
|
+
if (t3 === undefined) {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
for (let r4 = 0; r4 < Consts.h; r4++) {
|
|
231
|
+
const cStart4 = colIdxUnshifted(columnStart, 0);
|
|
232
|
+
const cEnd4 = colIdxUnshifted(colEnd, 0);
|
|
233
|
+
for (let c4 = cStart4; c4 <= cEnd4; c4++) {
|
|
234
|
+
const cell = t3[(c4 << Consts.logH) | r4];
|
|
235
|
+
if (cell === undefined) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
cb(
|
|
239
|
+
((r1 & Consts.mh) << (3 * Consts.logH)) |
|
|
240
|
+
((r2 & Consts.mh) << (2 * Consts.logH)) |
|
|
241
|
+
((r3 & Consts.mh) << Consts.logH) |
|
|
242
|
+
(r4 & Consts.mh),
|
|
243
|
+
(c1 << (3 * Consts.logW)) |
|
|
244
|
+
(c2 << (2 * Consts.logW)) |
|
|
245
|
+
(c3 << Consts.logW) |
|
|
246
|
+
c4,
|
|
247
|
+
cell,
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
204
257
|
}
|
|
205
258
|
|
|
206
259
|
// Remove unused warnings
|
|
@@ -210,24 +263,30 @@ forEachCellInColumn;
|
|
|
210
263
|
forEachCellInColumns;
|
|
211
264
|
|
|
212
265
|
function initGrid<T>(): SparseGrid<T> {
|
|
213
|
-
|
|
266
|
+
return [];
|
|
214
267
|
}
|
|
215
268
|
|
|
216
269
|
export class TiledGrid<T> {
|
|
217
|
-
|
|
270
|
+
private readonly cells: SparseGrid<T> = initGrid();
|
|
218
271
|
|
|
219
|
-
|
|
220
|
-
|
|
272
|
+
public get rowCount() {
|
|
273
|
+
return Consts.sizeH;
|
|
274
|
+
}
|
|
275
|
+
public get colCount() {
|
|
276
|
+
return Consts.sizeW;
|
|
277
|
+
}
|
|
221
278
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
279
|
+
public getCell(row: number, col: number) {
|
|
280
|
+
return getCell(row, col, this.cells);
|
|
281
|
+
}
|
|
225
282
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
283
|
+
public setCell(row: number, col: number, value: T) {
|
|
284
|
+
setCell(row, col, this.cells, value);
|
|
285
|
+
}
|
|
229
286
|
|
|
230
|
-
|
|
287
|
+
public get matrixProducer() {
|
|
288
|
+
return undefined as any;
|
|
289
|
+
}
|
|
231
290
|
}
|
|
232
291
|
|
|
233
292
|
pointwise("TiledGrid", new TiledGrid<number>());
|
package/bench/src/util.ts
CHANGED
|
@@ -15,38 +15,39 @@ let cached: any;
|
|
|
15
15
|
* Paranoid defense against dead code elimination.
|
|
16
16
|
*/
|
|
17
17
|
export function consume(value: any) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
count++;
|
|
19
|
+
if (count >>> 0 === 0) {
|
|
20
|
+
cached = value;
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Prevent v8"s optimizer from identifying "cached" as an unused value.
|
|
25
25
|
process.on("exit", () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if (count >>> 0 === 0) {
|
|
27
|
+
console.log(`Ignore this: ${cached}`);
|
|
28
|
+
}
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
export function randomId() {
|
|
32
|
-
|
|
33
|
-
.toString(36)
|
|
34
|
-
.slice(2);
|
|
32
|
+
return Math.random().toString(36).slice(2);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
export function createMatrix() {
|
|
38
|
-
|
|
36
|
+
return new SharedMatrixFactory().create(
|
|
37
|
+
new MockFluidDataStoreRuntime(),
|
|
38
|
+
randomId(),
|
|
39
|
+
) as SharedMatrix;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function createContiguousMatrix(rowCount: number, colCount: number) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const matrix = createMatrix();
|
|
44
|
+
matrix.insertRows(0, rowCount);
|
|
45
|
+
matrix.insertCols(0, colCount);
|
|
46
|
+
return matrix;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export function createFragmentedMatrix(rowCount: number, colCount: number) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const matrix = createMatrix();
|
|
51
|
+
insertFragmented(matrix, rowCount, colCount);
|
|
52
|
+
return matrix;
|
|
52
53
|
}
|
package/bench/tsconfig.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"types": ["node"]
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
"./src/**/*"
|
|
14
|
-
]
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"exclude": ["dist", "node_modules"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "..",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
},
|
|
9
|
+
"include": ["./src/**/*"],
|
|
15
10
|
}
|
package/dist/bspSet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bspSet.d.ts","sourceRoot":"","sources":["../src/bspSet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oDAAoD;AACpD,oBAAY,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7C,eAAO,MAAM,IAAI,6CAA6D,CAAC;AAK/E,oBAAY,OAAO;
|
|
1
|
+
{"version":3,"file":"bspSet.d.ts","sourceRoot":"","sources":["../src/bspSet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oDAAoD;AACpD,oBAA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