@cloudpss/ubjson 0.4.32 → 0.4.34

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.
Files changed (59) hide show
  1. package/dist/common/constants.d.ts +22 -20
  2. package/dist/common/constants.js +1 -21
  3. package/dist/common/constants.js.map +1 -1
  4. package/dist/common/decoder.d.ts +4 -20
  5. package/dist/common/decoder.js +217 -178
  6. package/dist/common/decoder.js.map +1 -1
  7. package/dist/common/encoder.d.ts +8 -54
  8. package/dist/common/encoder.js +241 -259
  9. package/dist/common/encoder.js.map +1 -1
  10. package/dist/common/string-decoder.d.ts +3 -8
  11. package/dist/common/string-decoder.js +190 -46
  12. package/dist/common/string-decoder.js.map +1 -1
  13. package/dist/common/string-encoder.d.ts +2 -8
  14. package/dist/common/string-encoder.js +8 -44
  15. package/dist/common/string-encoder.js.map +1 -1
  16. package/dist/encoder.js +2 -21
  17. package/dist/encoder.js.map +1 -1
  18. package/dist/index.d.ts +1 -2
  19. package/dist/index.js +2 -4
  20. package/dist/index.js.map +1 -1
  21. package/dist/rxjs/decoder.js +2 -2
  22. package/dist/rxjs/decoder.js.map +1 -1
  23. package/dist/rxjs/index.d.ts +1 -0
  24. package/dist/rxjs/index.js +1 -0
  25. package/dist/rxjs/index.js.map +1 -1
  26. package/dist/stream/index.d.ts +1 -0
  27. package/dist/stream/index.js +2 -1
  28. package/dist/stream/index.js.map +1 -1
  29. package/dist/stream-helper/decoder.d.ts +1 -1
  30. package/dist/stream-helper/decoder.js +1 -1
  31. package/dist/stream-helper/decoder.js.map +1 -1
  32. package/dist/stream-helper/encoder.js +2 -2
  33. package/dist/stream-helper/encoder.js.map +1 -1
  34. package/dist/utils.d.ts +5 -1
  35. package/dist/utils.js +13 -4
  36. package/dist/utils.js.map +1 -1
  37. package/package.json +3 -2
  38. package/src/common/constants.ts +22 -21
  39. package/src/common/decoder.ts +197 -162
  40. package/src/common/encoder.ts +230 -277
  41. package/src/common/string-decoder.ts +173 -41
  42. package/src/common/string-encoder.ts +10 -41
  43. package/src/encoder.ts +2 -16
  44. package/src/index.ts +2 -5
  45. package/src/rxjs/decoder.ts +2 -2
  46. package/src/rxjs/index.ts +1 -0
  47. package/src/stream/index.ts +2 -0
  48. package/src/stream-helper/decoder.ts +1 -1
  49. package/src/stream-helper/encoder.ts +2 -2
  50. package/src/utils.ts +14 -4
  51. package/tests/decode.js +69 -5
  52. package/tests/e2e.js +12 -1
  53. package/tests/encode.js +52 -23
  54. package/tests/rxjs/decode.js +3 -2
  55. package/tests/rxjs/encode.js +5 -8
  56. package/tests/stream/decode.js +2 -1
  57. package/tests/stream/encode.js +4 -5
  58. package/tests/string-encoding.js +77 -25
  59. package/tsconfig.json +3 -1
@@ -1,299 +1,281 @@
1
- import * as constants from './constants.js';
2
- import { StringEncoder } from './string-encoder.js';
1
+ import { getStringByteLength, getEncodeInto } from './string-encoder.js';
3
2
  /** 编码至 ubjson */
4
3
  export class EncoderBase {
5
4
  constructor(value) {
6
5
  this.value = value;
7
- /** 字符串编码 */
8
- this.stringEncoder = new StringEncoder();
6
+ this.stringByteLength = getStringByteLength();
7
+ this.encodeInto = getEncodeInto();
9
8
  /** 当前写指针位置 */
10
9
  this.length = 0;
11
10
  }
11
+ /** 编码至 ubjson */
12
+ writeValue() {
13
+ if (this.value === undefined) {
14
+ this.ensureCapacity(1);
15
+ this.buffer[this.length++] = 78 /* constants.NO_OP */;
16
+ return;
17
+ }
18
+ this.write(this.value);
19
+ }
12
20
  /** 写入一个对象 */
13
21
  write(value) {
14
22
  switch (typeof value) {
15
- case 'undefined':
16
- return this.writeNoOp();
17
- case 'boolean':
18
- return this.writeBoolean(value);
19
- case 'number':
20
- return this.writeNumber(value);
21
23
  case 'string':
22
- if (value.length === 1 && value.charCodeAt(0) < 255) {
23
- // 1 byte string
24
- return this.writeChar(value);
24
+ if (value.length === 1 && value.charCodeAt(0) < 128) {
25
+ // 1 byte ascii char
26
+ this.ensureCapacity(2);
27
+ this.buffer[this.length++] = 67 /* constants.CHAR */;
28
+ this.buffer[this.length++] = value.charCodeAt(0);
29
+ }
30
+ else {
31
+ this.ensureCapacity(2);
32
+ this.buffer[this.length++] = 83 /* constants.STRING */;
33
+ this.writeStringData(value);
34
+ }
35
+ return;
36
+ case 'number':
37
+ // eslint-disable-next-line unicorn/prefer-math-trunc
38
+ if ((value | 0) === value) {
39
+ if (value >= 0 && value <= 255) {
40
+ this.ensureCapacity(2);
41
+ this.buffer[this.length++] = 85 /* constants.UINT8 */;
42
+ this.buffer[this.length++] = value;
43
+ }
44
+ else if (value >= -128 && value <= 127) {
45
+ this.ensureCapacity(2);
46
+ this.buffer[this.length++] = 105 /* constants.INT8 */;
47
+ this.buffer[this.length++] = value;
48
+ }
49
+ else if (value >= -32768 && value <= 32767) {
50
+ this.ensureCapacity(3);
51
+ this.buffer[this.length++] = 73 /* constants.INT16 */;
52
+ this.buffer[this.length++] = value >> 8;
53
+ this.buffer[this.length++] = value & 0xff;
54
+ }
55
+ else {
56
+ this.ensureCapacity(5);
57
+ this.buffer[this.length++] = 108 /* constants.INT32 */;
58
+ this.view.setInt32(this.length, value);
59
+ this.length += 4;
60
+ }
61
+ }
62
+ else if (Number.isNaN(value) || Math.fround(value) === value) {
63
+ // 如果不会损失精度,使用 32 位浮点
64
+ this.ensureCapacity(5);
65
+ this.buffer[this.length++] = 100 /* constants.FLOAT32 */;
66
+ this.view.setFloat32(this.length, value);
67
+ this.length += 4;
25
68
  }
26
- return this.writeString(value);
69
+ else {
70
+ this.ensureCapacity(9);
71
+ this.buffer[this.length++] = 68 /* constants.FLOAT64 */;
72
+ this.view.setFloat64(this.length, value);
73
+ this.length += 8;
74
+ }
75
+ return;
27
76
  case 'object': {
28
77
  if (value === null) {
29
- return this.writeNull();
78
+ this.ensureCapacity(1);
79
+ this.buffer[this.length++] = 90 /* constants.NULL */;
80
+ }
81
+ else if (Array.isArray(value)) {
82
+ this.ensureCapacity(1);
83
+ this.buffer[this.length++] = 91 /* constants.ARRAY */;
84
+ const size = value.length;
85
+ for (let index = 0; index < size; index++) {
86
+ const element = value[index];
87
+ // 在数组中 undefined 和 function 也被视作 null 进行序列化
88
+ if (element == null || typeof element == 'function') {
89
+ this.ensureCapacity(1);
90
+ this.buffer[this.length++] = 90 /* constants.NULL */;
91
+ }
92
+ else {
93
+ this.write(element);
94
+ }
95
+ }
96
+ this.ensureCapacity(1);
97
+ this.buffer[this.length++] = 93 /* constants.ARRAY_END */;
30
98
  }
31
- if (Array.isArray(value)) {
32
- return this.writeArray(value);
99
+ else if (!ArrayBuffer.isView(value)) {
100
+ const toJSON = typeof value['toJSON'] == 'function';
101
+ if (toJSON) {
102
+ this.write(value.toJSON());
103
+ return;
104
+ }
105
+ this.ensureCapacity(1);
106
+ this.buffer[this.length++] = 123 /* constants.OBJECT */;
107
+ // 生成稳定的结果以便 hash 计算
108
+ const keys = Object.keys(value).sort();
109
+ const size = keys.length;
110
+ for (let index = 0; index < size; index++) {
111
+ const key = keys[index];
112
+ const element = value[key];
113
+ if (element === undefined || typeof element == 'function')
114
+ continue;
115
+ this.writeStringData(key);
116
+ this.write(element);
117
+ }
118
+ this.ensureCapacity(1);
119
+ this.buffer[this.length++] = 125 /* constants.OBJECT_END */;
33
120
  }
34
- if (ArrayBuffer.isView(value)) {
35
- return this.writeTypedArray(value);
121
+ else {
122
+ // ARRAY(1) + TYPE_MARKER(1) + TYPE(1) + COUNT_MARKER(1) + COUNT(MAX5) + DATA
123
+ this.ensureCapacity(9 + value.byteLength);
124
+ this.buffer[this.length++] = 91 /* constants.ARRAY */;
125
+ this.buffer[this.length++] = 36 /* constants.TYPE_MARKER */;
126
+ if (value instanceof Uint8Array || value instanceof Int8Array) {
127
+ // fast path for typed arrays with `BYTES_PER_ELEMENT` of 1
128
+ this.buffer[this.length++] = value instanceof Uint8Array ? 85 /* constants.UINT8 */ : 105 /* constants.INT8 */;
129
+ this.buffer[this.length++] = 35 /* constants.COUNT_MARKER */;
130
+ this.setLength(value.length);
131
+ this.buffer.set(value, this.length);
132
+ this.length += value.byteLength;
133
+ return;
134
+ }
135
+ const arrayLength = value.length;
136
+ const elementSize = value
137
+ .BYTES_PER_ELEMENT;
138
+ if (value instanceof Int16Array) {
139
+ this.buffer[this.length++] = 73 /* constants.INT16 */;
140
+ this.buffer[this.length++] = 35 /* constants.COUNT_MARKER */;
141
+ this.setLength(arrayLength);
142
+ for (let i = 0; i < arrayLength; i++) {
143
+ this.view.setInt16(this.length, value[i]);
144
+ this.length += elementSize;
145
+ }
146
+ }
147
+ else if (value instanceof Int32Array) {
148
+ this.buffer[this.length++] = 108 /* constants.INT32 */;
149
+ this.buffer[this.length++] = 35 /* constants.COUNT_MARKER */;
150
+ this.setLength(arrayLength);
151
+ for (let i = 0; i < arrayLength; i++) {
152
+ this.view.setInt32(this.length, value[i]);
153
+ this.length += elementSize;
154
+ }
155
+ }
156
+ else if (value instanceof Float32Array) {
157
+ this.buffer[this.length++] = 100 /* constants.FLOAT32 */;
158
+ this.buffer[this.length++] = 35 /* constants.COUNT_MARKER */;
159
+ this.setLength(arrayLength);
160
+ for (let i = 0; i < arrayLength; i++) {
161
+ this.view.setFloat32(this.length, value[i]);
162
+ this.length += elementSize;
163
+ }
164
+ }
165
+ else if (value instanceof Float64Array) {
166
+ this.buffer[this.length++] = 68 /* constants.FLOAT64 */;
167
+ this.buffer[this.length++] = 35 /* constants.COUNT_MARKER */;
168
+ this.setLength(arrayLength);
169
+ for (let i = 0; i < arrayLength; i++) {
170
+ this.view.setFloat64(this.length, value[i]);
171
+ this.length += elementSize;
172
+ }
173
+ }
174
+ else {
175
+ throw new TypeError(`Unsupported typed array type ${Object.prototype.toString.call(value)}`);
176
+ }
36
177
  }
37
- return this.writeObject(value);
178
+ return;
38
179
  }
180
+ case 'boolean':
181
+ this.ensureCapacity(1);
182
+ this.buffer[this.length++] = value ? 84 /* constants.TRUE */ : 70 /* constants.FALSE */;
183
+ return;
39
184
  default:
40
185
  throw new Error(`Unsupported type ${Object.prototype.toString.call(value)}`);
41
186
  }
42
187
  }
43
- /** 写入 marker */
44
- writeMarker(marker) {
45
- this.ensureCapacity(1);
46
- this.view.setUint8(this.length, marker);
47
- this.length += 1;
48
- }
49
- /** 写入 marker */
50
- writeNull() {
51
- this.writeMarker(constants.NULL);
52
- }
53
- /** writeNoOp */
54
- writeNoOp() {
55
- this.writeMarker(constants.NO_OP);
56
- }
57
- /** writeBoolean */
58
- writeBoolean(value) {
59
- this.writeMarker(value ? constants.TRUE : constants.FALSE);
60
- }
61
- /** writeInt8 */
62
- writeInt8(value) {
63
- this.writeMarker(constants.INT8);
64
- this.writeInt8Data(value);
65
- }
66
- /** writeInt8Data */
67
- writeInt8Data(value) {
68
- this.ensureCapacity(1);
69
- this.view.setInt8(this.length, value);
70
- this.length += 1;
71
- }
72
- /** writeUint8 */
73
- writeUint8(value) {
74
- this.writeMarker(constants.UINT8);
75
- this.writeUint8Data(value);
76
- }
77
- /** writeUint8Data */
78
- writeUint8Data(value) {
79
- this.ensureCapacity(1);
80
- this.view.setUint8(this.length, value);
81
- this.length += 1;
82
- }
83
- /** writeInt16 */
84
- writeInt16(value) {
85
- this.writeMarker(constants.INT16);
86
- this.writeInt16Data(value);
87
- }
88
- /** writeInt16Data */
89
- writeInt16Data(value) {
90
- this.ensureCapacity(2);
91
- this.view.setInt16(this.length, value);
92
- this.length += 2;
93
- }
94
- /** writeInt32 */
95
- writeInt32(value) {
96
- this.writeMarker(constants.INT32);
97
- this.writeInt32Data(value);
98
- }
99
- /** writeInt32Data */
100
- writeInt32Data(value) {
101
- this.ensureCapacity(4);
102
- this.view.setInt32(this.length, value);
103
- this.length += 4;
104
- }
105
- /** writeFloat32 */
106
- writeFloat32(value) {
107
- this.writeMarker(constants.FLOAT32);
108
- this.writeFloat32Data(value);
109
- }
110
- /** writeFloat32Data */
111
- writeFloat32Data(value) {
112
- this.ensureCapacity(4);
113
- this.view.setFloat32(this.length, value);
114
- this.length += 4;
115
- }
116
- /** writeFloat64 */
117
- writeFloat64(value) {
118
- this.writeMarker(constants.FLOAT64);
119
- this.writeFloat64Data(value);
120
- }
121
- /** writeFloat64Data */
122
- writeFloat64Data(value) {
123
- this.ensureCapacity(8);
124
- this.view.setFloat64(this.length, value);
125
- this.length += 8;
126
- }
127
- /** writeChar */
128
- writeChar(value) {
129
- this.writeMarker(constants.CHAR);
130
- this.writeCharData(value);
131
- }
132
- /** writeCharData */
133
- writeCharData(value) {
134
- this.ensureCapacity(1);
135
- this.view.setUint8(this.length, value.charCodeAt(0));
136
- this.length += 1;
137
- }
138
- /** writeString */
139
- writeString(value) {
140
- this.writeMarker(constants.STRING);
141
- this.writeStringData(value);
142
- }
143
188
  /** writeStringData */
144
189
  writeStringData(value) {
190
+ const strLength = value.length;
191
+ const maxUsage = strLength < 65536
192
+ ? // 对于短字符串,直接计算最大使用空间
193
+ strLength * 3
194
+ : this.stringByteLength(value);
195
+ // 一次性分配 setLength 和 encodeInto 的空间,避免无法回溯
196
+ // 额外分配 3 字节,避免 encodeInto 无法写入最后一个字符
197
+ this.ensureCapacity(maxUsage + 5 + 3);
198
+ // 预估头部大小
199
+ const headerSize = strLength < 128 ? 2 : strLength < 32768 ? 3 : 5;
200
+ const headerPos = this.length;
201
+ let bufLength;
145
202
  // 优化小字符串
146
- if (value.length < 32 || this.stringEncoder.encodeInto == null) {
147
- const buf = this.stringEncoder.encode(value);
148
- this.writeInt(buf.length);
149
- this.ensureCapacity(buf.length);
150
- this.buffer.set(buf, this.length);
151
- this.length += buf.length;
152
- return;
153
- }
154
- let maxUsage = value.length;
155
- if (value.length < 65536) {
156
- // 对于短字符串,直接计算最大使用空间
157
- maxUsage = value.length * 3;
203
+ if (strLength < 0x40 || !this.encodeInto) {
204
+ let c1, c2;
205
+ let strPosition = headerPos + headerSize;
206
+ const target = this.buffer;
207
+ for (let i = 0; i < strLength; i++) {
208
+ c1 = value.charCodeAt(i);
209
+ if (c1 < 0x80) {
210
+ target[strPosition++] = c1;
211
+ }
212
+ else if (c1 < 0x800) {
213
+ target[strPosition++] = (c1 >> 6) | 0xc0;
214
+ target[strPosition++] = (c1 & 0x3f) | 0x80;
215
+ }
216
+ else if ((c1 & 0xfc00) === 0xd800 && ((c2 = value.charCodeAt(i + 1)) & 0xfc00) === 0xdc00) {
217
+ c1 = 65536 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff);
218
+ i++;
219
+ target[strPosition++] = (c1 >> 18) | 0xf0;
220
+ target[strPosition++] = ((c1 >> 12) & 0x3f) | 0x80;
221
+ target[strPosition++] = ((c1 >> 6) & 0x3f) | 0x80;
222
+ target[strPosition++] = (c1 & 0x3f) | 0x80;
223
+ }
224
+ else {
225
+ target[strPosition++] = (c1 >> 12) | 0xe0;
226
+ target[strPosition++] = ((c1 >> 6) & 0x3f) | 0x80;
227
+ target[strPosition++] = (c1 & 0x3f) | 0x80;
228
+ }
229
+ }
230
+ bufLength = strPosition - headerPos - headerSize;
158
231
  }
159
232
  else {
160
- maxUsage = this.stringEncoder.byteLength(value);
233
+ bufLength = this.encodeInto(value, this.buffer, headerPos + headerSize);
161
234
  }
162
- // 一次性分配 writeInt encodeInto 的空间,避免无法回溯
163
- // 额外分配 3 字节,避免 encodeInto 无法写入最后一个字符
164
- this.ensureCapacity(maxUsage + 4 + 3);
165
- const currentPos = this.length;
166
- // 先写入最大大小
167
- const lengthWriter = this.writeInt(maxUsage);
168
- // 写入文本数据
169
- const { written, read } = this.stringEncoder.encodeInto(value, this.buffer.subarray(this.length));
170
- /* c8 ignore next 3 */
171
- if (read !== value.length) {
172
- throw new Error(`Failed to encode string with TextEncoder.encodeInto`);
235
+ if (bufLength < 128) {
236
+ this.buffer[this.length++] = 105 /* constants.INT8 */;
237
+ this.buffer[this.length++] = bufLength;
173
238
  }
174
- // 回溯,写入实际大小
175
- this.length = currentPos;
176
- lengthWriter.call(this, written);
177
- // 移动指针到写入末尾
178
- this.length += written;
239
+ else if (bufLength < 32768) {
240
+ if (headerSize < 3) {
241
+ this.buffer.copyWithin(headerPos + 3, headerPos + headerSize, headerPos + headerSize + bufLength);
242
+ }
243
+ this.buffer[this.length++] = 73 /* constants.INT16 */;
244
+ this.buffer[this.length++] = bufLength >> 8;
245
+ this.buffer[this.length++] = bufLength & 0xff;
246
+ }
247
+ else {
248
+ if (headerSize < 5) {
249
+ this.buffer.copyWithin(headerPos + 5, headerPos + headerSize, headerPos + headerSize + bufLength);
250
+ }
251
+ this.buffer[this.length++] = 108 /* constants.INT32 */;
252
+ this.view.setInt32(this.length, bufLength);
253
+ this.length += 4;
254
+ }
255
+ this.length += bufLength;
179
256
  }
180
257
  /**
181
- * 写入整形数字,选取合适的大小
182
- * @throws 无法在 int32 范围内表示
258
+ * 写入整形数字,选取合适的大小,需提前分配空间
183
259
  */
184
- writeInt(value) {
260
+ setLength(value) {
185
261
  // eslint-disable-next-line unicorn/prefer-math-trunc
186
262
  value = value | 0;
187
- if (value >= -128 && value <= 127) {
188
- this.writeInt8(value);
189
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
190
- return this.writeInt8;
263
+ if ((value & 0x7f) === value) {
264
+ this.buffer[this.length++] = 105 /* constants.INT8 */;
265
+ this.buffer[this.length++] = value;
266
+ return 1;
191
267
  }
192
268
  // 不使用 uint8 以保持兼容
193
- // if (value >= 0 && value <= 255) {
194
- // this.writeUint8(value);
195
- // /* eslint-disable-next-line @typescript-eslint/unbound-method */
196
- // return this.writeUint8;
197
- // }
198
- if (value >= -32768 && value <= 32767) {
199
- this.writeInt16(value);
200
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
201
- return this.writeInt16;
202
- }
203
- if (value >= -2147483648 && value <= 2147483647) {
204
- this.writeInt32(value);
205
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
206
- return this.writeInt32;
207
- }
208
- /* c8 ignore next 2 */
209
- throw new Error(`Unsupported int value ${value}: out of range`);
210
- }
211
- /** 写入数字,选取合适的大小 */
212
- writeNumber(value) {
213
- if (Number.isInteger(value) && value >= -2147483648 && value <= 2147483647) {
214
- if (value >= 0 && value <= 255)
215
- return this.writeUint8(value);
216
- this.writeInt(value);
217
- return;
218
- }
219
- if (!(Number.isNaN(value) || Math.fround(value) === value)) {
220
- return this.writeFloat64(value);
221
- }
222
- // 如果不会损失精度,则使用 32 位浮点
223
- return this.writeFloat32(value);
224
- }
225
- /** writeObject */
226
- writeObject(value) {
227
- this.writeMarker(constants.OBJECT);
228
- // 生成稳定的结果以便 hash 计算
229
- for (const key of Object.keys(value).sort()) {
230
- const element = value[key];
231
- if (element === undefined)
232
- continue;
233
- this.writeStringData(key);
234
- this.write(element);
235
- }
236
- this.writeMarker(constants.OBJECT_END);
237
- }
238
- /** writeArray */
239
- writeArray(value) {
240
- this.writeMarker(constants.ARRAY);
241
- for (const v of value) {
242
- // 在数组中 undefined 也被视作 null 进行序列化
243
- if (v == null)
244
- this.writeNull();
245
- else
246
- this.write(v);
247
- }
248
- this.writeMarker(constants.ARRAY_END);
249
- }
250
- /** writeArray */
251
- writeTypedArray(value) {
252
- this.writeMarker(constants.ARRAY);
253
- this.writeMarker(constants.TYPE_MARKER);
254
- if (value instanceof Uint8Array || value instanceof Int8Array) {
255
- // fast path for typed arrays with `BYTES_PER_ELEMENT` of 1
256
- this.writeMarker(value instanceof Uint8Array ? constants.UINT8 : constants.INT8);
257
- this.writeMarker(constants.COUNT_MARKER);
258
- this.writeInt(value.length);
259
- this.ensureCapacity(value.byteLength);
260
- this.buffer.set(value, this.length);
261
- this.length += value.byteLength;
262
- return;
263
- }
264
- /** 用于写入的 setter */
265
- let setValue;
266
- if (value instanceof Int16Array) {
267
- this.writeMarker(constants.INT16);
268
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
269
- setValue = this.view.setInt16;
270
- }
271
- else if (value instanceof Int32Array) {
272
- this.writeMarker(constants.INT32);
273
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
274
- setValue = this.view.setInt32;
275
- }
276
- else if (value instanceof Float32Array) {
277
- this.writeMarker(constants.FLOAT32);
278
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
279
- setValue = this.view.setFloat32;
280
- }
281
- else if (value instanceof Float64Array) {
282
- this.writeMarker(constants.FLOAT64);
283
- /* eslint-disable-next-line @typescript-eslint/unbound-method */
284
- setValue = this.view.setFloat64;
285
- }
286
- else {
287
- throw new TypeError(`Unsupported typed array type ${Object.prototype.toString.call(value)}`);
288
- }
289
- this.writeMarker(constants.COUNT_MARKER);
290
- this.writeInt(value.length);
291
- this.ensureCapacity(value.byteLength);
292
- // 不要在前面 bind,this.ensureCapacity 有可能导致 this.view 指向新的对象
293
- for (const v of value) {
294
- setValue.call(this.view, this.length, v);
295
- this.length += value.BYTES_PER_ELEMENT;
269
+ if ((value & 0x7fff) === value) {
270
+ this.buffer[this.length++] = 73 /* constants.INT16 */;
271
+ this.buffer[this.length++] = value >> 8;
272
+ this.buffer[this.length++] = value & 0xff;
273
+ return 2;
296
274
  }
275
+ this.buffer[this.length++] = 108 /* constants.INT32 */;
276
+ this.view.setInt32(this.length, value);
277
+ this.length += 4;
278
+ return 4;
297
279
  }
298
280
  }
299
281
  //# sourceMappingURL=encoder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../src/common/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,iBAAiB;AACjB,MAAM,OAAgB,WAAW;IAU7B,YAAqB,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;QATnC,YAAY;QACF,kBAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAC9C,cAAc;QACJ,WAAM,GAAG,CAAC,CAAC;IAMiB,CAAC;IAKvC,aAAa;IACH,KAAK,CAAC,KAAc;QAC1B,QAAQ,OAAO,KAAK,EAAE;YAClB,KAAK,WAAW;gBACZ,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,KAAK,SAAS;gBACV,OAAO,IAAI,C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;YAC3C,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;SACpB;QACD,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,KAAa;QAC3B,qDAAqD;QACrD,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,2BAAiB,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;YACnC,OAAO,CAAC,CAAC;SACZ;QACD,kBAAkB;QAClB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,KAAK,EAAE;YAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,2BAAkB,CAAC;YAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;YAC1C,OAAO,CAAC,CAAC;SACZ;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,4BAAkB,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QACjB,OAAO,CAAC,CAAC;IACb,CAAC;CACJ"}
@@ -2,12 +2,7 @@ export declare const textDecoder: TextDecoder | null;
2
2
  export declare const TEXT_ENCODER_THRESHOLD: number;
3
3
  /** 解码 */
4
4
  export declare function decodeJs(bytes: Uint8Array, begin: number, end: number): string;
5
- /** 解码 */
5
+ /** 字符串解码,无缓存 */
6
6
  export declare function decode(data: Uint8Array, begin: number, end: number): string;
7
- /** 特别优化字符串解码速度 */
8
- export declare class StringDecoder {
9
- /** 小字符串缓存 */
10
- private readonly cache;
11
- /** 字符串解码 */
12
- decode(data: Uint8Array, begin: number, end: number): string;
13
- }
7
+ /** 字符串解码,使用缓存 */
8
+ export declare function decodeKey(data: Uint8Array, begin: number, end: number): string;