@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.cjs
CHANGED
|
@@ -923,6 +923,7 @@ function serializeTextNode(n2, options) {
|
|
|
923
923
|
};
|
|
924
924
|
}
|
|
925
925
|
function serializeElementNode(n2, options) {
|
|
926
|
+
const start = performance.now();
|
|
926
927
|
const {
|
|
927
928
|
doc,
|
|
928
929
|
blockClass,
|
|
@@ -1114,6 +1115,18 @@ function serializeElementNode(n2, options) {
|
|
|
1114
1115
|
if (customElements.get(tagName)) isCustomElement = true;
|
|
1115
1116
|
} catch (e2) {
|
|
1116
1117
|
}
|
|
1118
|
+
const took = performance.now() - start;
|
|
1119
|
+
if (!(tagName in window.serialization_perf_map)) {
|
|
1120
|
+
window.serialization_perf_map[tagName] = {
|
|
1121
|
+
avg: 0,
|
|
1122
|
+
times: []
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
window.serialization_perf_map[tagName].times.push(took);
|
|
1126
|
+
if (window.serialization_perf_map[tagName].times.length > 1e3) {
|
|
1127
|
+
window.serialization_perf_map[tagName].times.shift();
|
|
1128
|
+
}
|
|
1129
|
+
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;
|
|
1117
1130
|
return {
|
|
1118
1131
|
type: NodeType$3.Element,
|
|
1119
1132
|
tagName,
|
|
@@ -1293,7 +1306,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1293
1306
|
}
|
|
1294
1307
|
let shadowRootEl = null;
|
|
1295
1308
|
if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
|
|
1296
|
-
|
|
1309
|
+
const childNodes2 = index$1.childNodes(shadowRootEl);
|
|
1310
|
+
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
1311
|
+
const childN = childNodes2[i2];
|
|
1297
1312
|
const serializedChildNode = serializeNodeWithId(
|
|
1298
1313
|
childN,
|
|
1299
1314
|
bypassOptions
|
|
@@ -9396,10 +9411,12 @@ class MutationBuffer {
|
|
|
9396
9411
|
__publicField(this, "tempPerfStore", {});
|
|
9397
9412
|
__publicField(this, "processMutations", (mutations) => {
|
|
9398
9413
|
const start = performance.now();
|
|
9414
|
+
let uniqueTypes = [];
|
|
9399
9415
|
for (const mut of mutations) {
|
|
9400
9416
|
const mutStart = performance.now();
|
|
9401
9417
|
this.processMutation(mut);
|
|
9402
9418
|
const took = performance.now() - mutStart;
|
|
9419
|
+
if (!uniqueTypes.includes(mut.type)) uniqueTypes.push(mut.type);
|
|
9403
9420
|
if (!(mut.type in this.tempPerfStore)) {
|
|
9404
9421
|
this.tempPerfStore[mut.type] = {
|
|
9405
9422
|
avg: 0,
|
|
@@ -9416,7 +9433,9 @@ class MutationBuffer {
|
|
|
9416
9433
|
mutations.length,
|
|
9417
9434
|
"mutations processed in",
|
|
9418
9435
|
performance.now() - start,
|
|
9419
|
-
"ms"
|
|
9436
|
+
"ms",
|
|
9437
|
+
"types:",
|
|
9438
|
+
uniqueTypes
|
|
9420
9439
|
);
|
|
9421
9440
|
window.temp_perf_store = this.tempPerfStore;
|
|
9422
9441
|
this.emit();
|
|
@@ -12270,6 +12289,7 @@ function record(options = {}) {
|
|
|
12270
12289
|
if (!recordDOM) {
|
|
12271
12290
|
return;
|
|
12272
12291
|
}
|
|
12292
|
+
const start = performance.now();
|
|
12273
12293
|
wrappedEmit(
|
|
12274
12294
|
{
|
|
12275
12295
|
type: EventType.Meta,
|
|
@@ -12337,6 +12357,7 @@ function record(options = {}) {
|
|
|
12337
12357
|
document.adoptedStyleSheets,
|
|
12338
12358
|
mirror.getId(document)
|
|
12339
12359
|
);
|
|
12360
|
+
console.log("full snapshot took", performance.now() - start, "ms");
|
|
12340
12361
|
};
|
|
12341
12362
|
try {
|
|
12342
12363
|
const handlers = [];
|