@glimt/record 0.0.20 → 0.0.21

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.
@@ -9435,12 +9435,32 @@ class MutationBuffer {
9435
9435
  __publicField(this, "canvasManager");
9436
9436
  __publicField(this, "processedNodeManager");
9437
9437
  __publicField(this, "unattachedDoc");
9438
+ __publicField(this, "tempPerfStore", {});
9438
9439
  __publicField(this, "processMutations", (mutations) => {
9439
- console.time("processMutations");
9440
+ const start = performance.now();
9440
9441
  for (const mut of mutations) {
9442
+ const mutStart = performance.now();
9441
9443
  this.processMutation(mut);
9444
+ const took = performance.now() - mutStart;
9445
+ if (!(mut.type in this.tempPerfStore)) {
9446
+ this.tempPerfStore[mut.type] = {
9447
+ avg: 0,
9448
+ times: []
9449
+ };
9450
+ }
9451
+ this.tempPerfStore[mut.type].times.push(took);
9452
+ if (this.tempPerfStore[mut.type].times.length > 1e3) {
9453
+ this.tempPerfStore[mut.type].times.shift();
9454
+ }
9455
+ this.tempPerfStore[mut.type].avg = this.tempPerfStore[mut.type].times.reduce((a2, b) => a2 + b, 0) / this.tempPerfStore[mut.type].times.length;
9442
9456
  }
9443
- console.timeEnd("processMutations");
9457
+ console.log(
9458
+ mutations.length,
9459
+ "mutations processed in",
9460
+ performance.now() - start,
9461
+ "ms"
9462
+ );
9463
+ window.temp_perf_store = this.tempPerfStore;
9444
9464
  this.emit();
9445
9465
  });
9446
9466
  __publicField(this, "emit", () => {