@glimt/record 0.0.58 → 0.0.59

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
@@ -1642,7 +1642,12 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1642
1642
  }
1643
1643
  return false;
1644
1644
  }
1645
+ const debugging = {
1646
+ index: 0,
1647
+ store: {}
1648
+ };
1645
1649
  function serializeNodeWithId(n2, options) {
1650
+ const start = Date.now();
1646
1651
  const {
1647
1652
  doc,
1648
1653
  mirror: mirror2,
@@ -1872,6 +1877,23 @@ function serializeNodeWithId(n2, options) {
1872
1877
  stylesheetLoadTimeout
1873
1878
  );
1874
1879
  }
1880
+ debugging.index++;
1881
+ const took = Date.now() - start;
1882
+ if (!(n2.nodeName in debugging.store)) {
1883
+ debugging.store[n2.nodeName] = [];
1884
+ }
1885
+ debugging.store[n2.nodeName].push(took);
1886
+ if (debugging.index % 100 === 0) {
1887
+ debugging.index = 0;
1888
+ const avgs = Object.entries(debugging.store).map(([key, values]) => {
1889
+ return {
1890
+ key,
1891
+ avg: values.reduce((a2, b) => a2 + b, 0) / values.length
1892
+ };
1893
+ });
1894
+ console.log("last 100 avgs", JSON.parse(JSON.stringify(avgs)));
1895
+ debugging.store = {};
1896
+ }
1875
1897
  return serializedNode;
1876
1898
  }
1877
1899
  function snapshot(n2, options) {