@glimt/record 0.0.19 → 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.
package/dist/record.js CHANGED
@@ -9391,12 +9391,32 @@ class MutationBuffer {
9391
9391
  __publicField(this, "canvasManager");
9392
9392
  __publicField(this, "processedNodeManager");
9393
9393
  __publicField(this, "unattachedDoc");
9394
+ __publicField(this, "tempPerfStore", {});
9394
9395
  __publicField(this, "processMutations", (mutations) => {
9395
- console.time("processMutations");
9396
+ const start = performance.now();
9396
9397
  for (const mut of mutations) {
9398
+ const mutStart = performance.now();
9397
9399
  this.processMutation(mut);
9400
+ const took = performance.now() - mutStart;
9401
+ if (!(mut.type in this.tempPerfStore)) {
9402
+ this.tempPerfStore[mut.type] = {
9403
+ avg: 0,
9404
+ times: []
9405
+ };
9406
+ }
9407
+ this.tempPerfStore[mut.type].times.push(took);
9408
+ if (this.tempPerfStore[mut.type].times.length > 1e3) {
9409
+ this.tempPerfStore[mut.type].times.shift();
9410
+ }
9411
+ this.tempPerfStore[mut.type].avg = this.tempPerfStore[mut.type].times.reduce((a2, b) => a2 + b, 0) / this.tempPerfStore[mut.type].times.length;
9398
9412
  }
9399
- console.timeEnd("processMutations");
9413
+ console.log(
9414
+ mutations.length,
9415
+ "mutations processed in",
9416
+ performance.now() - start,
9417
+ "ms"
9418
+ );
9419
+ window.temp_perf_store = this.tempPerfStore;
9400
9420
  this.emit();
9401
9421
  });
9402
9422
  __publicField(this, "emit", () => {