@fluidframework/merge-tree 2.93.0 → 2.101.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/sequencePlace.d.ts +13 -0
  7. package/dist/sequencePlace.d.ts.map +1 -1
  8. package/dist/sequencePlace.js +17 -4
  9. package/dist/sequencePlace.js.map +1 -1
  10. package/dist/test/Insertion.perf.spec.js +52 -39
  11. package/dist/test/Insertion.perf.spec.js.map +1 -1
  12. package/dist/test/PartialLengths.perf.spec.js +44 -41
  13. package/dist/test/PartialLengths.perf.spec.js.map +1 -1
  14. package/dist/test/Removal.perf.spec.js +105 -100
  15. package/dist/test/Removal.perf.spec.js.map +1 -1
  16. package/dist/test/Snapshot.perf.spec.js +14 -18
  17. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  18. package/dist/test/attributionCollection.perf.spec.js +41 -31
  19. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +1 -1
  23. package/lib/index.js.map +1 -1
  24. package/lib/sequencePlace.d.ts +13 -0
  25. package/lib/sequencePlace.d.ts.map +1 -1
  26. package/lib/sequencePlace.js +16 -3
  27. package/lib/sequencePlace.js.map +1 -1
  28. package/lib/test/Insertion.perf.spec.js +53 -40
  29. package/lib/test/Insertion.perf.spec.js.map +1 -1
  30. package/lib/test/PartialLengths.perf.spec.js +45 -42
  31. package/lib/test/PartialLengths.perf.spec.js.map +1 -1
  32. package/lib/test/Removal.perf.spec.js +106 -101
  33. package/lib/test/Removal.perf.spec.js.map +1 -1
  34. package/lib/test/Snapshot.perf.spec.js +15 -19
  35. package/lib/test/Snapshot.perf.spec.js.map +1 -1
  36. package/lib/test/attributionCollection.perf.spec.js +42 -32
  37. package/lib/test/attributionCollection.perf.spec.js.map +1 -1
  38. package/package.json +18 -18
  39. package/src/index.ts +1 -0
  40. package/src/sequencePlace.ts +17 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @fluidframework/merge-tree
2
2
 
3
+ ## 2.101.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.100.0
8
+
9
+ ### Minor Changes
10
+
11
+ - Node 22 is now the minimum supported Node.js version ([#27116](https://github.com/microsoft/FluidFramework/pull/27116)) [e8214d29663](https://github.com/microsoft/FluidFramework/commit/e8214d29663f5ee98d737daed82506a25d8de8d0)
12
+
13
+ All Fluid Framework client packages now require Node.js 22 or later. This aligns with the standing Node upgrade policy as Node 20 reaches end-of-life on April 30, 2026.
14
+
3
15
  ## 2.93.0
4
16
 
5
17
  Dependency updates only.
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { type AdjustParams, type IJSONSegment, type IMarkerDef, type IMergeTreeA
17
17
  export { addProperties, createMap, type MapLike, matchProperties, type PropertySet, } from "./properties.js";
18
18
  export { compareReferencePositions, DetachedReferencePosition, maxReferencePosition, minReferencePosition, type ReferencePosition, refGetTileLabels, refHasTileLabel, refHasTileLabels, refTypeIncludesFlag, reservedRangeLabelsKey, reservedTileLabelsKey, } from "./referencePositions.js";
19
19
  export { type PropsOrAdjust, copyPropertiesAndManager, PropertiesManager, } from "./segmentPropertiesManager.js";
20
- export { type InteriorSequencePlace, Side, type SequencePlace, endpointPosAndSide, } from "./sequencePlace.js";
20
+ export { type InteriorSequencePlace, Side, type SequencePlace, defaultSide, endpointPosAndSide, } from "./sequencePlace.js";
21
21
  export { SortedSet } from "./sortedSet.js";
22
22
  export { SortedSegmentSet, type SortedSegmentSetItem } from "./sortedSegmentSet.js";
23
23
  export { type IJSONTextSegment, TextSegment } from "./textSegment.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names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,EAClB,wBAAwB,EACxB,iBAAiB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,KAAK,qBAAqB,EAC1B,IAAI,EACJ,KAAK,aAAa,EAClB,WAAW,EACX,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACN,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kCAAkC,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxF,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.appendToMergeTreeDeltaRevertibles = exports.TextSegment = exports.SortedSegmentSet = exports.SortedSet = exports.endpointPosAndSide = exports.Side = exports.PropertiesManager = exports.copyPropertiesAndManager = exports.reservedTileLabelsKey = exports.reservedRangeLabelsKey = exports.refTypeIncludesFlag = exports.refHasTileLabels = exports.refHasTileLabel = exports.refGetTileLabels = exports.minReferencePosition = exports.maxReferencePosition = exports.DetachedReferencePosition = exports.compareReferencePositions = exports.matchProperties = exports.createMap = exports.addProperties = exports.ReferenceType = exports.MergeTreeDeltaType = exports.createObliterateRangeOp = exports.createRemoveRangeOp = exports.createInsertSegmentOp = exports.createInsertOp = exports.createGroupOp = exports.createAnnotateRangeOp = exports.TrackingGroupCollection = exports.TrackingGroup = exports.reservedMarkerSimpleTypeKey = exports.reservedMarkerIdKey = exports.Marker = exports.segmentIsRemoved = exports.CollaborationWindow = exports.BaseSegment = exports.MergeTreeMaintenanceType = exports.getSlideToSegoff = exports.SlidingPreference = exports.LocalReferenceCollection = exports.createDetachedLocalReferencePosition = exports.UniversalSequenceNumber = exports.UnassignedSequenceNumber = exports.RedBlackTree = exports.RBColor = exports.Client = exports.createPropertyTrackingAndInsertionAttributionPolicyFactory = exports.createPropertyTrackingAttributionPolicyFactory = exports.createInsertOnlyAttributionPolicy = void 0;
8
- exports.createLocalReconnectingPerspective = exports.revertMergeTreeDeltaRevertibles = exports.isMergeTreeDeltaRevertible = exports.discardMergeTreeDeltaRevertible = void 0;
7
+ exports.TextSegment = exports.SortedSegmentSet = exports.SortedSet = exports.endpointPosAndSide = exports.defaultSide = exports.Side = exports.PropertiesManager = exports.copyPropertiesAndManager = exports.reservedTileLabelsKey = exports.reservedRangeLabelsKey = exports.refTypeIncludesFlag = exports.refHasTileLabels = exports.refHasTileLabel = exports.refGetTileLabels = exports.minReferencePosition = exports.maxReferencePosition = exports.DetachedReferencePosition = exports.compareReferencePositions = exports.matchProperties = exports.createMap = exports.addProperties = exports.ReferenceType = exports.MergeTreeDeltaType = exports.createObliterateRangeOp = exports.createRemoveRangeOp = exports.createInsertSegmentOp = exports.createInsertOp = exports.createGroupOp = exports.createAnnotateRangeOp = exports.TrackingGroupCollection = exports.TrackingGroup = exports.reservedMarkerSimpleTypeKey = exports.reservedMarkerIdKey = exports.Marker = exports.segmentIsRemoved = exports.CollaborationWindow = exports.BaseSegment = exports.MergeTreeMaintenanceType = exports.getSlideToSegoff = exports.SlidingPreference = exports.LocalReferenceCollection = exports.createDetachedLocalReferencePosition = exports.UniversalSequenceNumber = exports.UnassignedSequenceNumber = exports.RedBlackTree = exports.RBColor = exports.Client = exports.createPropertyTrackingAndInsertionAttributionPolicyFactory = exports.createPropertyTrackingAttributionPolicyFactory = exports.createInsertOnlyAttributionPolicy = void 0;
8
+ exports.createLocalReconnectingPerspective = exports.revertMergeTreeDeltaRevertibles = exports.isMergeTreeDeltaRevertible = exports.discardMergeTreeDeltaRevertible = exports.appendToMergeTreeDeltaRevertibles = void 0;
9
9
  var attributionPolicy_js_1 = require("./attributionPolicy.js");
10
10
  Object.defineProperty(exports, "createInsertOnlyAttributionPolicy", { enumerable: true, get: function () { return attributionPolicy_js_1.createInsertOnlyAttributionPolicy; } });
11
11
  Object.defineProperty(exports, "createPropertyTrackingAttributionPolicyFactory", { enumerable: true, get: function () { return attributionPolicy_js_1.createPropertyTrackingAttributionPolicyFactory; } });
@@ -66,6 +66,7 @@ Object.defineProperty(exports, "copyPropertiesAndManager", { enumerable: true, g
66
66
  Object.defineProperty(exports, "PropertiesManager", { enumerable: true, get: function () { return segmentPropertiesManager_js_1.PropertiesManager; } });
67
67
  var sequencePlace_js_1 = require("./sequencePlace.js");
68
68
  Object.defineProperty(exports, "Side", { enumerable: true, get: function () { return sequencePlace_js_1.Side; } });
69
+ Object.defineProperty(exports, "defaultSide", { enumerable: true, get: function () { return sequencePlace_js_1.defaultSide; } });
69
70
  Object.defineProperty(exports, "endpointPosAndSide", { enumerable: true, get: function () { return sequencePlace_js_1.endpointPosAndSide; } });
70
71
  var sortedSet_js_1 = require("./sortedSet.js");
71
72
  Object.defineProperty(exports, "SortedSet", { enumerable: true, get: function () { return sortedSet_js_1.SortedSet; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AASH,+DAIgC;AAH/B,yIAAA,iCAAiC,OAAA;AACjC,sJAAA,8CAA8C,OAAA;AAC9C,kKAAA,0DAA0D,OAAA;AAE3D,yCAAyD;AAAhD,mGAAA,MAAM,OAAA;AACf,mDAcgC;AAL/B,mGAAA,OAAO,OAAA;AAGP,wGAAA,YAAY,OAAA;AAGb,+CAAmF;AAA1E,wHAAA,w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OAAA;AAEnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAClB,6DAAoF;AAA3E,uHAAA,gBAAgB,OAAA;AACzB,mDAAsE;AAAtC,6GAAA,WAAW,OAAA;AAC3C,mDAO0B;AANzB,mIAAA,iCAAiC,OAAA;AACjC,iIAAA,+BAA+B,OAAA;AAC/B,4HAAA,0BAA0B,OAAA;AAG1B,iIAAA,+BAA+B,OAAA;AAGhC,mDAAwF;AAA/E,oIAAA,kCAAkC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tIAttributionCollection,\n\tIAttributionCollectionSerializer,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n\tSequenceOffsets,\n} from \"./attributionCollection.js\";\nexport {\n\tcreateInsertOnlyAttributionPolicy,\n\tcreatePropertyTrackingAttributionPolicyFactory,\n\tcreatePropertyTrackingAndInsertionAttributionPolicyFactory,\n} from \"./attributionPolicy.js\";\nexport { Client, type IClientEvents } from \"./client.js\";\nexport {\n\ttype ConflictAction,\n\ttype Dictionary,\n\ttype IRBAugmentation,\n\ttype IRBMatcher,\n\ttype KeyComparer,\n\ttype Property,\n\ttype PropertyAction,\n\ttype QProperty,\n\tRBColor,\n\ttype RBNode,\n\ttype RBNodeActions,\n\tRedBlackTree,\n\ttype SortedDictionary,\n} from \"./collections/index.js\";\nexport { UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nexport {\n\tcreateDetachedLocalReferencePosition,\n\tLocalReferenceCollection,\n\ttype LocalReferencePosition,\n\tSlidingPreference,\n} from \"./localReference.js\";\nexport {\n\ttype AttributionPolicy,\n\ttype IMergeTreeAttributionOptions,\n\ttype IMergeTreeOptions,\n\ttype IMergeTreeOptionsInternal,\n\tgetSlideToSegoff,\n} from \"./mergeTree.js\";\nexport {\n\ttype IMergeTreeDeltaCallbackArgs,\n\ttype IMergeTreeDeltaOpArgs,\n\ttype IMergeTreeMaintenanceCallbackArgs,\n\ttype IMergeTreeSegmentDelta,\n\ttype MergeTreeDeltaOperationType,\n\ttype MergeTreeDeltaOperationTypes,\n\tMergeTreeMaintenanceType,\n} from \"./mergeTreeDeltaCallback.js\";\nexport {\n\tBaseSegment,\n\tCollaborationWindow,\n\ttype IJSONMarkerSegment,\n\tsegmentIsRemoved,\n\ttype ISegment,\n\ttype ISegmentAction,\n\tMarker,\n\treservedMarkerIdKey,\n\treservedMarkerSimpleTypeKey,\n\ttype ISegmentInternal,\n} from \"./mergeTreeNodes.js\";\nexport {\n\ttype Trackable,\n\tTrackingGroup,\n\ttype ITrackingGroup,\n\tTrackingGroupCollection,\n} from \"./mergeTreeTracking.js\";\nexport {\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateInsertSegmentOp,\n\tcreateRemoveRangeOp,\n\tcreateObliterateRangeOp,\n} from \"./opBuilder.js\";\nexport {\n\ttype AdjustParams,\n\ttype IJSONSegment,\n\ttype IMarkerDef,\n\ttype IMergeTreeAnnotateMsg,\n\ttype IMergeTreeDelta,\n\ttype IMergeTreeDeltaOp,\n\ttype IMergeTreeGroupMsg,\n\ttype IMergeTreeInsertMsg,\n\ttype IMergeTreeOp,\n\ttype IMergeTreeRemoveMsg,\n\ttype IMergeTreeAnnotateAdjustMsg,\n\ttype IRelativePosition,\n\tMergeTreeDeltaType,\n\tReferenceType,\n\ttype IMergeTreeObliterateMsg,\n\ttype IMergeTreeObliterateSidedMsg,\n} from \"./ops.js\";\nexport {\n\taddProperties,\n\tcreateMap,\n\ttype MapLike,\n\tmatchProperties,\n\ttype PropertySet,\n} from \"./properties.js\";\nexport {\n\tcompareReferencePositions,\n\tDetachedReferencePosition,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\ttype ReferencePosition,\n\trefGetTileLabels,\n\trefHasTileLabel,\n\trefHasTileLabels,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\treservedTileLabelsKey,\n} from \"./referencePositions.js\";\nexport {\n\ttype PropsOrAdjust,\n\tcopyPropertiesAndManager,\n\tPropertiesManager,\n} from \"./segmentPropertiesManager.js\";\nexport {\n\ttype InteriorSequencePlace,\n\tSide,\n\ttype SequencePlace,\n\tendpointPosAndSide,\n} from \"./sequencePlace.js\";\nexport { SortedSet } from \"./sortedSet.js\";\nexport { SortedSegmentSet, type SortedSegmentSetItem } from \"./sortedSegmentSet.js\";\nexport { type IJSONTextSegment, TextSegment } from \"./textSegment.js\";\nexport {\n\tappendToMergeTreeDeltaRevertibles,\n\tdiscardMergeTreeDeltaRevertible,\n\tisMergeTreeDeltaRevertible,\n\ttype MergeTreeDeltaRevertible,\n\ttype MergeTreeRevertibleDriver,\n\trevertMergeTreeDeltaRevertibles,\n} from \"./revertibles.js\";\nexport type { OperationStamp } from \"./stamps.js\";\nexport { createLocalReconnectingPerspective, type Perspective } from \"./perspective.js\";\nexport type { IMergeTreeTextHelper } from \"./MergeTreeTextHelper.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AASH,+DAIgC;AAH/B,yIAAA,iCAAiC,OAAA;AACjC,sJAAA,8CAA8C,OAAA;AAC9C,kKAAA,0DAA0D,OAAA;AAE3D,yCAAyD;AAAhD,mGAAA,MAAM,OAAA;AACf,mDAcgC;AAL/B,mGAAA,OAAO,OAAA;AAGP,wGAAA,YAAY,OAAA;AAGb,+CAAmF;AAA1E,wHAAA,wBAAwB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAC1D,yDAK6B;AAJ5B,yIAAA,oCAAoC,OAAA;AACpC,6HAAA,wBAAwB,OAAA;AAExB,sHAAA,iBAAiB,OAAA;AAElB,+CAMwB;AADvB,gHAAA,gBAAgB,OAAA;AAEjB,yEAQqC;AADpC,qIAAA,wBAAwB,OAAA;AAEzB,yDAW6B;AAV5B,gHAAA,WAAW,OAAA;AACX,wHAAA,mBAAmB,OAAA;AAEnB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AAA/E,oIAAA,kCAAkC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tIAttributionCollection,\n\tIAttributionCollectionSerializer,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n\tSequenceOffsets,\n} from \"./attributionCollection.js\";\nexport {\n\tcreateInsertOnlyAttributionPolicy,\n\tcreatePropertyTrackingAttributionPolicyFactory,\n\tcreatePropertyTrackingAndInsertionAttributionPolicyFactory,\n} from \"./attributionPolicy.js\";\nexport { Client, type IClientEvents } from \"./client.js\";\nexport {\n\ttype ConflictAction,\n\ttype Dictionary,\n\ttype IRBAugmentation,\n\ttype IRBMatcher,\n\ttype KeyComparer,\n\ttype Property,\n\ttype PropertyAction,\n\ttype QProperty,\n\tRBColor,\n\ttype RBNode,\n\ttype RBNodeActions,\n\tRedBlackTree,\n\ttype SortedDictionary,\n} from \"./collections/index.js\";\nexport { UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nexport {\n\tcreateDetachedLocalReferencePosition,\n\tLocalReferenceCollection,\n\ttype LocalReferencePosition,\n\tSlidingPreference,\n} from \"./localReference.js\";\nexport {\n\ttype AttributionPolicy,\n\ttype IMergeTreeAttributionOptions,\n\ttype IMergeTreeOptions,\n\ttype IMergeTreeOptionsInternal,\n\tgetSlideToSegoff,\n} from \"./mergeTree.js\";\nexport {\n\ttype IMergeTreeDeltaCallbackArgs,\n\ttype IMergeTreeDeltaOpArgs,\n\ttype IMergeTreeMaintenanceCallbackArgs,\n\ttype IMergeTreeSegmentDelta,\n\ttype MergeTreeDeltaOperationType,\n\ttype MergeTreeDeltaOperationTypes,\n\tMergeTreeMaintenanceType,\n} from \"./mergeTreeDeltaCallback.js\";\nexport {\n\tBaseSegment,\n\tCollaborationWindow,\n\ttype IJSONMarkerSegment,\n\tsegmentIsRemoved,\n\ttype ISegment,\n\ttype ISegmentAction,\n\tMarker,\n\treservedMarkerIdKey,\n\treservedMarkerSimpleTypeKey,\n\ttype ISegmentInternal,\n} from \"./mergeTreeNodes.js\";\nexport {\n\ttype Trackable,\n\tTrackingGroup,\n\ttype ITrackingGroup,\n\tTrackingGroupCollection,\n} from \"./mergeTreeTracking.js\";\nexport {\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateInsertSegmentOp,\n\tcreateRemoveRangeOp,\n\tcreateObliterateRangeOp,\n} from \"./opBuilder.js\";\nexport {\n\ttype AdjustParams,\n\ttype IJSONSegment,\n\ttype IMarkerDef,\n\ttype IMergeTreeAnnotateMsg,\n\ttype IMergeTreeDelta,\n\ttype IMergeTreeDeltaOp,\n\ttype IMergeTreeGroupMsg,\n\ttype IMergeTreeInsertMsg,\n\ttype IMergeTreeOp,\n\ttype IMergeTreeRemoveMsg,\n\ttype IMergeTreeAnnotateAdjustMsg,\n\ttype IRelativePosition,\n\tMergeTreeDeltaType,\n\tReferenceType,\n\ttype IMergeTreeObliterateMsg,\n\ttype IMergeTreeObliterateSidedMsg,\n} from \"./ops.js\";\nexport {\n\taddProperties,\n\tcreateMap,\n\ttype MapLike,\n\tmatchProperties,\n\ttype PropertySet,\n} from \"./properties.js\";\nexport {\n\tcompareReferencePositions,\n\tDetachedReferencePosition,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\ttype ReferencePosition,\n\trefGetTileLabels,\n\trefHasTileLabel,\n\trefHasTileLabels,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\treservedTileLabelsKey,\n} from \"./referencePositions.js\";\nexport {\n\ttype PropsOrAdjust,\n\tcopyPropertiesAndManager,\n\tPropertiesManager,\n} from \"./segmentPropertiesManager.js\";\nexport {\n\ttype InteriorSequencePlace,\n\tSide,\n\ttype SequencePlace,\n\tdefaultSide,\n\tendpointPosAndSide,\n} from \"./sequencePlace.js\";\nexport { SortedSet } from \"./sortedSet.js\";\nexport { SortedSegmentSet, type SortedSegmentSetItem } from \"./sortedSegmentSet.js\";\nexport { type IJSONTextSegment, TextSegment } from \"./textSegment.js\";\nexport {\n\tappendToMergeTreeDeltaRevertibles,\n\tdiscardMergeTreeDeltaRevertible,\n\tisMergeTreeDeltaRevertible,\n\ttype MergeTreeDeltaRevertible,\n\ttype MergeTreeRevertibleDriver,\n\trevertMergeTreeDeltaRevertibles,\n} from \"./revertibles.js\";\nexport type { OperationStamp } from \"./stamps.js\";\nexport { createLocalReconnectingPerspective, type Perspective } from \"./perspective.js\";\nexport type { IMergeTreeTextHelper } from \"./MergeTreeTextHelper.js\";\n"]}
@@ -48,6 +48,19 @@ export declare enum Side {
48
48
  Before = 0,
49
49
  After = 1
50
50
  }
51
+ /**
52
+ * The {@link Side} a bare numeric `SequencePlace` resolves to when no side is
53
+ * explicitly provided. Exported so callers that need to detect "the caller
54
+ * didn't specify a side" (such as serialized op replay) can compare against
55
+ * this without hardcoding `Side.Before`.
56
+ *
57
+ * Note: this only governs the bare-numeric case. The `"start"` and `"end"`
58
+ * literals are normalized by `normalizePlace` with their own conventions
59
+ * (`"start"` → `Side.After`, `"end"` → `Side.Before`) and are unrelated to
60
+ * `defaultSide`.
61
+ * @internal
62
+ */
63
+ export declare const defaultSide = Side.Before;
51
64
  /**
52
65
  * Returns the position and side of the start and end of a sequence.
53
66
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePlace.d.ts","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,qBAAqB,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACX;AAED;;;;;GAKG;AACH,oBAAY,IAAI;IACf,MAAM,IAAI;IACV,KAAK,IAAI;CACT;AAED;;;;GAIG;AACH,wBAAgB,k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c,CAAC,KAAK,EAAE,aAAa,GAAG,qBAAqB,CAW1E"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.normalizePlace = exports.endpointPosAndSide = exports.Side = void 0;
7
+ exports.normalizePlace = exports.endpointPosAndSide = exports.defaultSide = exports.Side = void 0;
8
8
  /**
9
9
  * Defines a side relative to a character in a sequence.
10
10
  *
@@ -16,6 +16,19 @@ var Side;
16
16
  Side[Side["Before"] = 0] = "Before";
17
17
  Side[Side["After"] = 1] = "After";
18
18
  })(Side || (exports.Side = Side = {}));
19
+ /**
20
+ * The {@link Side} a bare numeric `SequencePlace` resolves to when no side is
21
+ * explicitly provided. Exported so callers that need to detect "the caller
22
+ * didn't specify a side" (such as serialized op replay) can compare against
23
+ * this without hardcoding `Side.Before`.
24
+ *
25
+ * Note: this only governs the bare-numeric case. The `"start"` and `"end"`
26
+ * literals are normalized by `normalizePlace` with their own conventions
27
+ * (`"start"` → `Side.After`, `"end"` → `Side.Before`) and are unrelated to
28
+ * `defaultSide`.
29
+ * @internal
30
+ */
31
+ exports.defaultSide = Side.Before;
19
32
  /**
20
33
  * Returns the position and side of the start and end of a sequence.
21
34
  *
@@ -24,8 +37,8 @@ var Side;
24
37
  function endpointPosAndSide(start, end) {
25
38
  const startIsPlainEndpoint = typeof start === "number" || start === "start" || start === "end";
26
39
  const endIsPlainEndpoint = typeof end === "number" || end === "start" || end === "end";
27
- const startSide = startIsPlainEndpoint ? Side.Before : start?.side;
28
- const endSide = endIsPlainEndpoint ? Side.Before : end?.side;
40
+ const startSide = startIsPlainEndpoint ? exports.defaultSide : start?.side;
41
+ const endSide = endIsPlainEndpoint ? exports.defaultSide : end?.side;
29
42
  const startPos = startIsPlainEndpoint ? start : start?.pos;
30
43
  const endPos = endIsPlainEndpoint ? end : end?.pos;
31
44
  return {
@@ -41,7 +54,7 @@ exports.endpointPosAndSide = endpointPosAndSide;
41
54
  */
42
55
  function normalizePlace(place) {
43
56
  if (typeof place === "number") {
44
- return { pos: place, side: Side.Before };
57
+ return { pos: place, side: exports.defaultSide };
45
58
  }
46
59
  if (place === "start") {
47
60
  return { pos: -1, side: Side.After };
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePlace.js","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;;;;GAKG;AACH,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CACjC,KAAgC,EAChC,GAA8B;IAO9B,MAAM,oBAAoB,GACzB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,KAAK,CAAC;IACnE,MAAM,kBAAkB,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,CAAC;IAEvF,MAAM,SAAS,GAAG,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC;IACnE,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC;IAE7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC;IAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnD,OAAO;QACN,SAAS;QACT,OAAO;QACP,QAAQ;QACR,MAAM;KACN,CAAC;AACH,CAAC;AAzBD,gDAyBC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAoB;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAXD,wCAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Defines a position and side relative to a character in a sequence.\n *\n * For this purpose, sequences look like:\n *\n * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`\n *\n * Each `{value}` in the diagram is a character within a sequence.\n * Each `-` in the above diagram is a position where text could be inserted.\n * Each position between a `{value}` and a `-` is a `SequencePlace`.\n *\n * The special endpoints `{start}` and `{end}` refer to positions outside the\n * contents of the string.\n *\n * This gives us 2N + 2 possible positions to refer to within a string, where N\n * is the number of characters.\n *\n * If the position is specified with a bare number, the side defaults to\n * `Side.Before`.\n *\n * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),\n * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.\n * E.g. the start of a range with Side.After is exclusive of the character at the position.\n * @legacy @beta\n */\nexport type SequencePlace = number | \"start\" | \"end\" | InteriorSequencePlace;\n\n/**\n * A sequence place that does not refer to the special endpoint segments.\n *\n * See {@link SequencePlace} for additional context.\n * @legacy @beta\n */\nexport interface InteriorSequencePlace {\n\tpos: number;\n\tside: Side;\n}\n\n/**\n * Defines a side relative to a character in a sequence.\n *\n * @remarks See {@link SequencePlace} for additional context on usage.\n * @legacy @beta\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * Returns the position and side of the start and end of a sequence.\n *\n * @legacy @beta\n */\nexport function endpointPosAndSide(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n): {\n\tstartSide: Side | undefined;\n\tendSide: Side | undefined;\n\tstartPos: number | \"start\" | \"end\" | undefined;\n\tendPos: number | \"start\" | \"end\" | undefined;\n} {\n\tconst startIsPlainEndpoint =\n\t\ttypeof start === \"number\" || start === \"start\" || start === \"end\";\n\tconst endIsPlainEndpoint = typeof end === \"number\" || end === \"start\" || end === \"end\";\n\n\tconst startSide = startIsPlainEndpoint ? Side.Before : start?.side;\n\tconst endSide = endIsPlainEndpoint ? Side.Before : end?.side;\n\n\tconst startPos = startIsPlainEndpoint ? start : start?.pos;\n\tconst endPos = endIsPlainEndpoint ? end : end?.pos;\n\n\treturn {\n\t\tstartSide,\n\t\tendSide,\n\t\tstartPos,\n\t\tendPos,\n\t};\n}\n\n/**\n * Returns the given place in InteriorSequencePlace form.\n */\nexport function normalizePlace(place: SequencePlace): InteriorSequencePlace {\n\tif (typeof place === \"number\") {\n\t\treturn { pos: place, side: Side.Before };\n\t}\n\tif (place === \"start\") {\n\t\treturn { pos: -1, side: Side.After };\n\t}\n\tif (place === \"end\") {\n\t\treturn { pos: -1, side: Side.Before };\n\t}\n\treturn place;\n}\n"]}
1
+ {"version":3,"file":"sequencePlace.js","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;;;;GAKG;AACH,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf;AAED;;;;;;;;;;;GAWG;AACU,QAAA,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;AAEvC;;;;GAIG;AACH,SAAgB,kBAAkB,CACjC,KAAgC,EAChC,GA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esContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Defines a position and side relative to a character in a sequence.\n *\n * For this purpose, sequences look like:\n *\n * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`\n *\n * Each `{value}` in the diagram is a character within a sequence.\n * Each `-` in the above diagram is a position where text could be inserted.\n * Each position between a `{value}` and a `-` is a `SequencePlace`.\n *\n * The special endpoints `{start}` and `{end}` refer to positions outside the\n * contents of the string.\n *\n * This gives us 2N + 2 possible positions to refer to within a string, where N\n * is the number of characters.\n *\n * If the position is specified with a bare number, the side defaults to\n * `Side.Before`.\n *\n * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),\n * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.\n * E.g. the start of a range with Side.After is exclusive of the character at the position.\n * @legacy @beta\n */\nexport type SequencePlace = number | \"start\" | \"end\" | InteriorSequencePlace;\n\n/**\n * A sequence place that does not refer to the special endpoint segments.\n *\n * See {@link SequencePlace} for additional context.\n * @legacy @beta\n */\nexport interface InteriorSequencePlace {\n\tpos: number;\n\tside: Side;\n}\n\n/**\n * Defines a side relative to a character in a sequence.\n *\n * @remarks See {@link SequencePlace} for additional context on usage.\n * @legacy @beta\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * The {@link Side} a bare numeric `SequencePlace` resolves to when no side is\n * explicitly provided. Exported so callers that need to detect \"the caller\n * didn't specify a side\" (such as serialized op replay) can compare against\n * this without hardcoding `Side.Before`.\n *\n * Note: this only governs the bare-numeric case. The `\"start\"` and `\"end\"`\n * literals are normalized by `normalizePlace` with their own conventions\n * (`\"start\"` → `Side.After`, `\"end\"` → `Side.Before`) and are unrelated to\n * `defaultSide`.\n * @internal\n */\nexport const defaultSide = Side.Before;\n\n/**\n * Returns the position and side of the start and end of a sequence.\n *\n * @legacy @beta\n */\nexport function endpointPosAndSide(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n): {\n\tstartSide: Side | undefined;\n\tendSide: Side | undefined;\n\tstartPos: number | \"start\" | \"end\" | undefined;\n\tendPos: number | \"start\" | \"end\" | undefined;\n} {\n\tconst startIsPlainEndpoint =\n\t\ttypeof start === \"number\" || start === \"start\" || start === \"end\";\n\tconst endIsPlainEndpoint = typeof end === \"number\" || end === \"start\" || end === \"end\";\n\n\tconst startSide = startIsPlainEndpoint ? defaultSide : start?.side;\n\tconst endSide = endIsPlainEndpoint ? defaultSide : end?.side;\n\n\tconst startPos = startIsPlainEndpoint ? start : start?.pos;\n\tconst endPos = endIsPlainEndpoint ? end : end?.pos;\n\n\treturn {\n\t\tstartSide,\n\t\tendSide,\n\t\tstartPos,\n\t\tendPos,\n\t};\n}\n\n/**\n * Returns the given place in InteriorSequencePlace form.\n */\nexport function normalizePlace(place: SequencePlace): InteriorSequencePlace {\n\tif (typeof place === \"number\") {\n\t\treturn { pos: place, side: defaultSide };\n\t}\n\tif (place === \"start\") {\n\t\treturn { pos: -1, side: Side.After };\n\t}\n\tif (place === \"end\") {\n\t\treturn { pos: -1, side: Side.Before };\n\t}\n\treturn place;\n}\n"]}
@@ -17,52 +17,65 @@ function constructTree(numOfSegments) {
17
17
  }
18
18
  const TREE_SIZE = 7500;
19
19
  describe("MergeTree insertion", () => {
20
- (0, benchmark_1.benchmark)({
21
- type: benchmark_1.BenchmarkType.Measurement,
20
+ (0, benchmark_1.benchmarkIt)({
22
21
  title: "insert into empty tree",
23
- benchmarkFn: () => {
24
- const emptyTree = new mergeTree_js_1.MergeTree();
25
- emptyTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], emptyTree.localPerspective, { seq: 0, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
26
- },
22
+ ...(0, benchmark_1.benchmarkDuration)({
23
+ benchmarkFn: () => {
24
+ const emptyTree = new mergeTree_js_1.MergeTree();
25
+ emptyTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], emptyTree.localPerspective, { seq: 0, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
26
+ },
27
+ }),
27
28
  });
28
- let startTree = constructTree(TREE_SIZE);
29
- (0, benchmark_1.benchmark)({
30
- type: benchmark_1.BenchmarkType.Measurement,
29
+ (0, benchmark_1.benchmarkIt)({
31
30
  title: "insert at start of large tree",
32
- benchmarkFn: () => {
33
- for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
34
- startTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], startTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
35
- }
36
- },
37
- beforeEachBatch: () => {
38
- startTree = constructTree(TREE_SIZE);
39
- },
31
+ ...(0, benchmark_1.benchmarkDuration)({
32
+ benchmarkFnCustom: async (state) => {
33
+ let startTree = constructTree(TREE_SIZE);
34
+ let keepRunning;
35
+ do {
36
+ startTree = constructTree(TREE_SIZE);
37
+ keepRunning = state.timeBatch(() => {
38
+ for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
39
+ startTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], startTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
40
+ }
41
+ });
42
+ } while (keepRunning);
43
+ },
44
+ }),
40
45
  });
41
- let middleTree = constructTree(TREE_SIZE);
42
- (0, benchmark_1.benchmark)({
43
- type: benchmark_1.BenchmarkType.Measurement,
46
+ (0, benchmark_1.benchmarkIt)({
44
47
  title: "insert at middle of large tree",
45
- benchmarkFn: () => {
46
- for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
47
- middleTree.insertSegments(TREE_SIZE / 2, [textSegment_js_1.TextSegment.make("a")], middleTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
48
- }
49
- },
50
- beforeEachBatch: () => {
51
- middleTree = constructTree(TREE_SIZE);
52
- },
48
+ ...(0, benchmark_1.benchmarkDuration)({
49
+ benchmarkFnCustom: async (state) => {
50
+ let middleTree = constructTree(TREE_SIZE);
51
+ let keepRunning;
52
+ do {
53
+ middleTree = constructTree(TREE_SIZE);
54
+ keepRunning = state.timeBatch(() => {
55
+ for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
56
+ middleTree.insertSegments(TREE_SIZE / 2, [textSegment_js_1.TextSegment.make("a")], middleTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
57
+ }
58
+ });
59
+ } while (keepRunning);
60
+ },
61
+ }),
53
62
  });
54
- let endTree = constructTree(TREE_SIZE);
55
- (0, benchmark_1.benchmark)({
56
- type: benchmark_1.BenchmarkType.Measurement,
63
+ (0, benchmark_1.benchmarkIt)({
57
64
  title: "insert at end of large tree",
58
- benchmarkFn: () => {
59
- for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
60
- endTree.insertSegments(i, [textSegment_js_1.TextSegment.make("a")], endTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
61
- }
62
- },
63
- beforeEachBatch: () => {
64
- endTree = constructTree(TREE_SIZE);
65
- },
65
+ ...(0, benchmark_1.benchmarkDuration)({
66
+ benchmarkFnCustom: async (state) => {
67
+ let endTree = constructTree(TREE_SIZE);
68
+ let keepRunning;
69
+ do {
70
+ endTree = constructTree(TREE_SIZE);
71
+ keepRunning = state.timeBatch(() => {
72
+ for (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {
73
+ endTree.insertSegments(i, [textSegment_js_1.TextSegment.make("a")], endTree.localPerspective, { seq: i + 1, clientId: 0 }, { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } });
74
+ }
75
+ });
76
+ } while (keepRunning);
77
+ },
78
+ }),
66
79
  });
67
80
  });
68
81
  //# sourceMappingURL=Insertion.perf.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":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e,EAAE,GAAG,EAAE;YACrB,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC;KACD,CAAC,CAAC;IAEH,IAAI,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IACvC,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,GAAG,EAAE;YACjB,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,OAAO,CAAC,cAAc,CACrB,CAAC,EACD,CAAC,4BAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACvB,OAAO,CAAC,gBAAgB,EACxB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAC3B,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,2BAAkB,CAAC,MAAM,EAAE,EAAE,CAC3C,CAAC;YACH,CAAC;QACF,CAAC;QACD,eAAe,EAAE,GAAG,EAAE;YACrB,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { MergeTree } from \"../mergeTree.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { TextSegment } from \"../textSegment.js\";\n\nfunction constructTree(numOfSegments: number): MergeTree {\n\tconst mergeTree = new MergeTree();\n\tfor (let i = 0; i < numOfSegments; i++) {\n\t\tmergeTree.insertSegments(\n\t\t\t0,\n\t\t\t[TextSegment.make(\"a\")],\n\t\t\tmergeTree.localPerspective,\n\t\t\t{ seq: i, clientId: 0 },\n\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t);\n\t}\n\treturn mergeTree;\n}\n\nconst TREE_SIZE: number = 7500;\n\ndescribe(\"MergeTree insertion\", () => {\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"insert into empty tree\",\n\t\tbenchmarkFn: () => {\n\t\t\tconst emptyTree = new MergeTree();\n\t\t\temptyTree.insertSegments(\n\t\t\t\t0,\n\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\temptyTree.localPerspective,\n\t\t\t\t{ seq: 0, clientId: 0 },\n\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t);\n\t\t},\n\t});\n\n\tlet startTree = constructTree(TREE_SIZE);\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"insert at start of large tree\",\n\t\tbenchmarkFn: () => {\n\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\tstartTree.insertSegments(\n\t\t\t\t\t0,\n\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\tstartTree.localPerspective,\n\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tbeforeEachBatch: () => {\n\t\t\tstartTree = constructTree(TREE_SIZE);\n\t\t},\n\t});\n\n\tlet middleTree = constructTree(TREE_SIZE);\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"insert at middle of large tree\",\n\t\tbenchmarkFn: () => {\n\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\tmiddleTree.insertSegments(\n\t\t\t\t\tTREE_SIZE / 2,\n\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\tmiddleTree.localPerspective,\n\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tbeforeEachBatch: () => {\n\t\t\tmiddleTree = constructTree(TREE_SIZE);\n\t\t},\n\t});\n\n\tlet endTree = constructTree(TREE_SIZE);\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"insert at end of large tree\",\n\t\tbenchmarkFn: () => {\n\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\tendTree.insertSegments(\n\t\t\t\t\ti,\n\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\tendTree.localPerspective,\n\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tbeforeEachBatch: () => {\n\t\t\tendTree = constructTree(TREE_SIZE);\n\t\t},\n\t});\n});\n"]}
1
+ {"version":3,"file":"Insertion.perf.spec.js","sourceRoot":"","sources":["../../src/test/Insertion.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAwE;AAExE,kDAA4C;AAC5C,sCAA+C;AAC/C,sDAAgD;AAEhD,SAAS,aAAa,CAAC,aAAqB;IAC3C,MAAM,SAAS,GAAG,IAAI,wBAAS,EAAE,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,SAAS,CAAC,cAAc,CACvB,CAAC,EACD,CAAC,4BAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACvB,SAAS,CAAC,gBAAgB,EAC1B,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EACvB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,2BAAkB,CAAC,MAAM,EAAE,EAAE,CAC3C,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,SAAS,GA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AAa,CAAC,SAAS,CAAC,CAAC;oBACnC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;wBAClC,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;4BACjD,OAAO,CAAC,cAAc,CACrB,CAAC,EACD,CAAC,4BAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACvB,OAAO,CAAC,gBAAgB,EACxB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAC3B,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,2BAAkB,CAAC,MAAM,EAAE,EAAE,CAC3C,CAAC;wBACH,CAAC;oBACF,CAAC,CAAC,CAAC;gBACJ,CAAC,QAAQ,WAAW,EAAE;YACvB,CAAC;SACD,CAAC;KACF,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\n\nimport { MergeTree } from \"../mergeTree.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { TextSegment } from \"../textSegment.js\";\n\nfunction constructTree(numOfSegments: number): MergeTree {\n\tconst mergeTree = new MergeTree();\n\tfor (let i = 0; i < numOfSegments; i++) {\n\t\tmergeTree.insertSegments(\n\t\t\t0,\n\t\t\t[TextSegment.make(\"a\")],\n\t\t\tmergeTree.localPerspective,\n\t\t\t{ seq: i, clientId: 0 },\n\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t);\n\t}\n\treturn mergeTree;\n}\n\nconst TREE_SIZE: number = 7500;\n\ndescribe(\"MergeTree insertion\", () => {\n\tbenchmarkIt({\n\t\ttitle: \"insert into empty tree\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tconst emptyTree = new MergeTree();\n\t\t\t\temptyTree.insertSegments(\n\t\t\t\t\t0,\n\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\temptyTree.localPerspective,\n\t\t\t\t\t{ seq: 0, clientId: 0 },\n\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t);\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: \"insert at start of large tree\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tlet startTree = constructTree(TREE_SIZE);\n\t\t\t\tlet keepRunning: boolean;\n\t\t\t\tdo {\n\t\t\t\t\tstartTree = constructTree(TREE_SIZE);\n\t\t\t\t\tkeepRunning = state.timeBatch(() => {\n\t\t\t\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\t\t\t\tstartTree.insertSegments(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\t\t\tstartTree.localPerspective,\n\t\t\t\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} while (keepRunning);\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: \"insert at middle of large tree\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tlet middleTree = constructTree(TREE_SIZE);\n\t\t\t\tlet keepRunning: boolean;\n\t\t\t\tdo {\n\t\t\t\t\tmiddleTree = constructTree(TREE_SIZE);\n\t\t\t\t\tkeepRunning = state.timeBatch(() => {\n\t\t\t\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\t\t\t\tmiddleTree.insertSegments(\n\t\t\t\t\t\t\t\tTREE_SIZE / 2,\n\t\t\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\t\t\tmiddleTree.localPerspective,\n\t\t\t\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} while (keepRunning);\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: \"insert at end of large tree\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tlet endTree = constructTree(TREE_SIZE);\n\t\t\t\tlet keepRunning: boolean;\n\t\t\t\tdo {\n\t\t\t\t\tendTree = constructTree(TREE_SIZE);\n\t\t\t\t\tkeepRunning = state.timeBatch(() => {\n\t\t\t\t\t\tfor (let i = TREE_SIZE; i < TREE_SIZE + 25; i++) {\n\t\t\t\t\t\t\tendTree.insertSegments(\n\t\t\t\t\t\t\t\ti,\n\t\t\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\t\t\tendTree.localPerspective,\n\t\t\t\t\t\t\t\t{ seq: i + 1, clientId: 0 },\n\t\t\t\t\t\t\t\t{ op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} while (keepRunning);\n\t\t\t},\n\t\t}),\n\t});\n});\n"]}
@@ -10,50 +10,53 @@ const ops_js_1 = require("../ops.js");
10
10
  const perspective_js_1 = require("../perspective.js");
11
11
  const textSegment_js_1 = require("../textSegment.js");
12
12
  describe("MergeTree partial lengths", () => {
13
- const originalIncrementalUpdate = mergeTree_js_1.MergeTree.options.incrementalUpdate;
14
13
  for (const incremental of [true, false]) {
15
- (0, benchmark_1.benchmark)({
16
- type: benchmark_1.BenchmarkType.Measurement,
14
+ (0, benchmark_1.benchmarkIt)({
17
15
  title: `incremental updates = ${incremental}`,
18
16
  category: "partial lengths",
19
- before: () => {
20
- mergeTree_js_1.MergeTree.options.incrementalUpdate = incremental;
21
- },
22
- benchmarkFn: () => {
23
- const mergeTree = new mergeTree_js_1.MergeTree();
24
- const clientId = 0;
25
- let i = 1;
26
- for (; i < 1001; i++) {
27
- const stamp = {
28
- seq: i,
29
- clientId,
30
- };
31
- mergeTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], new perspective_js_1.PriorPerspective(i, clientId), stamp, {
32
- op: { type: ops_js_1.MergeTreeDeltaType.INSERT },
33
- });
34
- }
35
- for (; i < 2001; i++) {
36
- const stamp = {
37
- seq: i,
38
- clientId,
39
- };
40
- mergeTree.markRangeRemoved(i - 1001, i - 1000, new perspective_js_1.PriorPerspective(i, clientId), stamp, {
41
- op: { type: ops_js_1.MergeTreeDeltaType.REMOVE },
42
- });
43
- }
44
- for (; i < 3001; i++) {
45
- const stamp = {
46
- seq: i,
47
- clientId,
48
- };
49
- mergeTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], new perspective_js_1.PriorPerspective(i, clientId), stamp, {
50
- op: { type: ops_js_1.MergeTreeDeltaType.INSERT },
51
- });
52
- }
53
- },
54
- after: () => {
55
- mergeTree_js_1.MergeTree.options.incrementalUpdate = originalIncrementalUpdate;
56
- },
17
+ ...(0, benchmark_1.benchmarkDuration)({
18
+ benchmarkFnCustom: async (state) => {
19
+ const originalIncrementalUpdate = mergeTree_js_1.MergeTree.options.incrementalUpdate;
20
+ mergeTree_js_1.MergeTree.options.incrementalUpdate = incremental;
21
+ try {
22
+ state.timeAllBatches(() => {
23
+ const mergeTree = new mergeTree_js_1.MergeTree();
24
+ const clientId = 0;
25
+ let i = 1;
26
+ for (; i < 1001; i++) {
27
+ const stamp = {
28
+ seq: i,
29
+ clientId,
30
+ };
31
+ mergeTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], new perspective_js_1.PriorPerspective(i, clientId), stamp, {
32
+ op: { type: ops_js_1.MergeTreeDeltaType.INSERT },
33
+ });
34
+ }
35
+ for (; i < 2001; i++) {
36
+ const stamp = {
37
+ seq: i,
38
+ clientId,
39
+ };
40
+ mergeTree.markRangeRemoved(i - 1001, i - 1000, new perspective_js_1.PriorPerspective(i, clientId), stamp, {
41
+ op: { type: ops_js_1.MergeTreeDeltaType.REMOVE },
42
+ });
43
+ }
44
+ for (; i < 3001; i++) {
45
+ const stamp = {
46
+ seq: i,
47
+ clientId,
48
+ };
49
+ mergeTree.insertSegments(0, [textSegment_js_1.TextSegment.make("a")], new perspective_js_1.PriorPerspective(i, clientId), stamp, {
50
+ op: { type: ops_js_1.MergeTreeDeltaType.INSERT },
51
+ });
52
+ }
53
+ });
54
+ }
55
+ finally {
56
+ mergeTree_js_1.MergeTree.options.incrementalUpdate = originalIncrementalUpdate;
57
+ }
58
+ },
59
+ }),
57
60
  });
58
61
  }
59
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PartialLengths.perf.spec.js","sourceRoot":"","sources":["../../src/test/PartialLengths.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAElE,kDAA4C;AAC5C,sCAA+C;AAC/C,sDAAqD;AAErD,sDAAgD;AAEhD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC1C,MAAM,yBAAyB,GAAY,wBAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAE/E,KAAK,MAAM,WAAW,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,IAAA,qBAAS,EAAC;YACT,IAAI,EAAE,yBAAa,CAAC,WAAW;YAC/B,KAAK,EAAE,yBAAyB,WAAW,EAAE;YAC7C,QAAQ,EAAE,iBAAiB;YAC3B,MAAM,EAAE,GAAG,EAAE;gBACZ,wBAAS,CAAC,OAAO,CAAC,iBAAiB,GAAG,WAAW,CAAC;YACnD,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBACjB,MAAM,SAAS,GAAG,IA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CAAC;gBACH,CAAC;YACF,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,wBAAS,CAAC,OAAO,CAAC,iBAAiB,GAAG,yBAAyB,CAAC;YACjE,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { MergeTree } from \"../mergeTree.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { PriorPerspective } from \"../perspective.js\";\nimport type { OperationStamp } from \"../stamps.js\";\nimport { TextSegment } from \"../textSegment.js\";\n\ndescribe(\"MergeTree partial lengths\", () => {\n\tconst originalIncrementalUpdate: boolean = MergeTree.options.incrementalUpdate;\n\n\tfor (const incremental of [true, false]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: `incremental updates = ${incremental}`,\n\t\t\tcategory: \"partial lengths\",\n\t\t\tbefore: () => {\n\t\t\t\tMergeTree.options.incrementalUpdate = incremental;\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tconst mergeTree = new MergeTree();\n\n\t\t\t\tconst clientId = 0;\n\t\t\t\tlet i = 1;\n\t\t\t\tfor (; i < 1001; i++) {\n\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t};\n\t\t\t\t\tmergeTree.insertSegments(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.INSERT },\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tfor (; i < 2001; i++) {\n\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t};\n\t\t\t\t\tmergeTree.markRangeRemoved(\n\t\t\t\t\t\ti - 1001,\n\t\t\t\t\t\ti - 1000,\n\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.REMOVE },\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tfor (; i < 3001; i++) {\n\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t};\n\t\t\t\t\tmergeTree.insertSegments(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.INSERT },\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tafter: () => {\n\t\t\t\tMergeTree.options.incrementalUpdate = originalIncrementalUpdate;\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
1
+ {"version":3,"file":"PartialLengths.perf.spec.js","sourceRoot":"","sources":["../../src/test/PartialLengths.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAwE;AAExE,kDAA4C;AAC5C,sCAA+C;AAC/C,sDAAqD;AAErD,sDAAgD;AAEhD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC1C,KAAK,MAAM,WAAW,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,IAAA,uBAAW,EAAC;YACX,KAAK,EAAE,yBAAyB,WAAW,EAAE;YAC7C,QAAQ,EAAE,iBAAiB;YAC3B,GAAG,IAAA,6BAAiB,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AAG,EAAE,CAAC;oCACN,QAAQ;iCACR,CAAC;gCACF,SAAS,CAAC,cAAc,CACvB,CAAC,EACD,CAAC,4BAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACvB,IAAI,iCAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,EACjC,KAAK,EACL;oCACC,EAAE,EAAE,EAAE,IAAI,EAAE,2BAAkB,CAAC,MAAM,EAAE;iCACvC,CACD,CAAC;4BACH,CAAC;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC;4BAAS,CAAC;wBACV,wBAAS,CAAC,OAAO,CAAC,iBAAiB,GAAG,yBAAyB,CAAC;oBACjE,CAAC;gBACF,CAAC;aACD,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\n\nimport { MergeTree } from \"../mergeTree.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { PriorPerspective } from \"../perspective.js\";\nimport type { OperationStamp } from \"../stamps.js\";\nimport { TextSegment } from \"../textSegment.js\";\n\ndescribe(\"MergeTree partial lengths\", () => {\n\tfor (const incremental of [true, false]) {\n\t\tbenchmarkIt({\n\t\t\ttitle: `incremental updates = ${incremental}`,\n\t\t\tcategory: \"partial lengths\",\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst originalIncrementalUpdate: boolean = MergeTree.options.incrementalUpdate;\n\t\t\t\t\tMergeTree.options.incrementalUpdate = incremental;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\t\tconst mergeTree = new MergeTree();\n\n\t\t\t\t\t\t\tconst clientId = 0;\n\t\t\t\t\t\t\tlet i = 1;\n\t\t\t\t\t\t\tfor (; i < 1001; i++) {\n\t\t\t\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tmergeTree.insertSegments(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.INSERT },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (; i < 2001; i++) {\n\t\t\t\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tmergeTree.markRangeRemoved(\n\t\t\t\t\t\t\t\t\ti - 1001,\n\t\t\t\t\t\t\t\t\ti - 1000,\n\t\t\t\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.REMOVE },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (; i < 3001; i++) {\n\t\t\t\t\t\t\t\tconst stamp: OperationStamp = {\n\t\t\t\t\t\t\t\t\tseq: i,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tmergeTree.insertSegments(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t[TextSegment.make(\"a\")],\n\t\t\t\t\t\t\t\t\tnew PriorPerspective(i, clientId),\n\t\t\t\t\t\t\t\t\tstamp,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\top: { type: MergeTreeDeltaType.INSERT },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tMergeTree.options.incrementalUpdate = originalIncrementalUpdate;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t}\n});\n"]}