@glimt/record 0.0.21 → 0.0.22
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/record.cjs +23 -2
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +23 -2
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +23 -2
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +24 -24
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.js
CHANGED
|
@@ -921,6 +921,7 @@ function serializeTextNode(n2, options) {
|
|
|
921
921
|
};
|
|
922
922
|
}
|
|
923
923
|
function serializeElementNode(n2, options) {
|
|
924
|
+
const start = performance.now();
|
|
924
925
|
const {
|
|
925
926
|
doc,
|
|
926
927
|
blockClass,
|
|
@@ -1112,6 +1113,18 @@ function serializeElementNode(n2, options) {
|
|
|
1112
1113
|
if (customElements.get(tagName)) isCustomElement = true;
|
|
1113
1114
|
} catch (e2) {
|
|
1114
1115
|
}
|
|
1116
|
+
const took = performance.now() - start;
|
|
1117
|
+
if (!(tagName in window.serialization_perf_map)) {
|
|
1118
|
+
window.serialization_perf_map[tagName] = {
|
|
1119
|
+
avg: 0,
|
|
1120
|
+
times: []
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
window.serialization_perf_map[tagName].times.push(took);
|
|
1124
|
+
if (window.serialization_perf_map[tagName].times.length > 1e3) {
|
|
1125
|
+
window.serialization_perf_map[tagName].times.shift();
|
|
1126
|
+
}
|
|
1127
|
+
window.serialization_perf_map[tagName].avg = window.serialization_perf_map[tagName].times.reduce((a2, b) => a2 + b, 0) / window.serialization_perf_map[tagName].times.length;
|
|
1115
1128
|
return {
|
|
1116
1129
|
type: NodeType$3.Element,
|
|
1117
1130
|
tagName,
|
|
@@ -1291,7 +1304,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1291
1304
|
}
|
|
1292
1305
|
let shadowRootEl = null;
|
|
1293
1306
|
if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
|
|
1294
|
-
|
|
1307
|
+
const childNodes2 = index$1.childNodes(shadowRootEl);
|
|
1308
|
+
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
1309
|
+
const childN = childNodes2[i2];
|
|
1295
1310
|
const serializedChildNode = serializeNodeWithId(
|
|
1296
1311
|
childN,
|
|
1297
1312
|
bypassOptions
|
|
@@ -9394,10 +9409,12 @@ class MutationBuffer {
|
|
|
9394
9409
|
__publicField(this, "tempPerfStore", {});
|
|
9395
9410
|
__publicField(this, "processMutations", (mutations) => {
|
|
9396
9411
|
const start = performance.now();
|
|
9412
|
+
let uniqueTypes = [];
|
|
9397
9413
|
for (const mut of mutations) {
|
|
9398
9414
|
const mutStart = performance.now();
|
|
9399
9415
|
this.processMutation(mut);
|
|
9400
9416
|
const took = performance.now() - mutStart;
|
|
9417
|
+
if (!uniqueTypes.includes(mut.type)) uniqueTypes.push(mut.type);
|
|
9401
9418
|
if (!(mut.type in this.tempPerfStore)) {
|
|
9402
9419
|
this.tempPerfStore[mut.type] = {
|
|
9403
9420
|
avg: 0,
|
|
@@ -9414,7 +9431,9 @@ class MutationBuffer {
|
|
|
9414
9431
|
mutations.length,
|
|
9415
9432
|
"mutations processed in",
|
|
9416
9433
|
performance.now() - start,
|
|
9417
|
-
"ms"
|
|
9434
|
+
"ms",
|
|
9435
|
+
"types:",
|
|
9436
|
+
uniqueTypes
|
|
9418
9437
|
);
|
|
9419
9438
|
window.temp_perf_store = this.tempPerfStore;
|
|
9420
9439
|
this.emit();
|
|
@@ -12268,6 +12287,7 @@ function record(options = {}) {
|
|
|
12268
12287
|
if (!recordDOM) {
|
|
12269
12288
|
return;
|
|
12270
12289
|
}
|
|
12290
|
+
const start = performance.now();
|
|
12271
12291
|
wrappedEmit(
|
|
12272
12292
|
{
|
|
12273
12293
|
type: EventType.Meta,
|
|
@@ -12335,6 +12355,7 @@ function record(options = {}) {
|
|
|
12335
12355
|
document.adoptedStyleSheets,
|
|
12336
12356
|
mirror.getId(document)
|
|
12337
12357
|
);
|
|
12358
|
+
console.log("full snapshot took", performance.now() - start, "ms");
|
|
12338
12359
|
};
|
|
12339
12360
|
try {
|
|
12340
12361
|
const handlers = [];
|