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