@fluidframework/merge-tree 2.0.0-internal.8.0.0 → 2.0.0-rc.1.0.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.
- package/CHANGELOG.md +38 -0
- package/README.md +0 -6
- package/api-extractor-esm.json +17 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +0 -4
- package/api-report/merge-tree.api.md +4 -9
- package/dist/client.d.ts +0 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -7
- package/dist/client.js.map +1 -1
- package/dist/merge-tree-alpha.d.ts +27 -12
- package/dist/merge-tree-beta.d.ts +0 -16
- package/dist/merge-tree-public.d.ts +0 -16
- package/dist/merge-tree-untrimmed.d.ts +5 -29
- package/dist/mergeTree.d.ts +0 -17
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +0 -130
- package/dist/mergeTree.js.map +1 -1
- package/dist/ops.d.ts +1 -1
- package/dist/ops.js +1 -1
- package/dist/ops.js.map +1 -1
- package/dist/revertibles.d.ts +4 -4
- package/dist/revertibles.js +3 -3
- package/dist/revertibles.js.map +1 -1
- package/dist/test/Insertion.perf.spec.d.ts +6 -0
- package/dist/test/Insertion.perf.spec.d.ts.map +1 -0
- package/dist/test/Insertion.perf.spec.js +113 -0
- package/dist/test/Insertion.perf.spec.js.map +1 -0
- package/dist/test/PartialLengths.perf.spec.d.ts +6 -0
- package/dist/test/PartialLengths.perf.spec.d.ts.map +1 -0
- package/dist/test/PartialLengths.perf.spec.js +67 -0
- package/dist/test/PartialLengths.perf.spec.js.map +1 -0
- package/dist/test/Removal.perf.spec.d.ts +6 -0
- package/dist/test/Removal.perf.spec.d.ts.map +1 -0
- package/dist/test/Removal.perf.spec.js +166 -0
- package/dist/test/Removal.perf.spec.js.map +1 -0
- package/dist/test/Snapshot.perf.spec.d.ts +6 -0
- package/dist/test/Snapshot.perf.spec.d.ts.map +1 -0
- package/dist/test/Snapshot.perf.spec.js +33 -0
- package/dist/test/Snapshot.perf.spec.js.map +1 -0
- package/dist/test/attributionCollection.perf.spec.d.ts +6 -0
- package/dist/test/attributionCollection.perf.spec.d.ts.map +1 -0
- package/dist/test/attributionCollection.perf.spec.js +231 -0
- package/dist/test/attributionCollection.perf.spec.js.map +1 -0
- package/dist/test/attributionCollection.spec.d.ts +6 -0
- package/dist/test/attributionCollection.spec.d.ts.map +1 -0
- package/dist/test/attributionCollection.spec.js +486 -0
- package/dist/test/attributionCollection.spec.js.map +1 -0
- package/dist/test/attributionPolicy.spec.d.ts +6 -0
- package/dist/test/attributionPolicy.spec.d.ts.map +1 -0
- package/dist/test/attributionPolicy.spec.js +189 -0
- package/dist/test/attributionPolicy.spec.js.map +1 -0
- package/dist/test/beastTest.d.ts +54 -0
- package/dist/test/beastTest.d.ts.map +1 -0
- package/dist/test/beastTest.js +1333 -0
- package/dist/test/beastTest.js.map +1 -0
- package/dist/test/client.annotateMarker.spec.d.ts +6 -0
- package/dist/test/client.annotateMarker.spec.d.ts.map +1 -0
- package/dist/test/client.annotateMarker.spec.js +45 -0
- package/dist/test/client.annotateMarker.spec.js.map +1 -0
- package/dist/test/client.apis.d.ts +7 -0
- package/dist/test/client.apis.d.ts.map +1 -0
- package/dist/test/client.apis.js +72 -0
- package/dist/test/client.apis.js.map +1 -0
- package/dist/test/client.applyMsg.spec.d.ts +6 -0
- package/dist/test/client.applyMsg.spec.d.ts.map +1 -0
- package/dist/test/client.applyMsg.spec.js +500 -0
- package/dist/test/client.applyMsg.spec.js.map +1 -0
- package/dist/test/client.applyStashedOpFarm.spec.d.ts +12 -0
- package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
- package/dist/test/client.applyStashedOpFarm.spec.js +144 -0
- package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -0
- package/dist/test/client.attributionFarm.spec.d.ts +7 -0
- package/dist/test/client.attributionFarm.spec.d.ts.map +1 -0
- package/dist/test/client.attributionFarm.spec.js +96 -0
- package/dist/test/client.attributionFarm.spec.js.map +1 -0
- package/dist/test/client.conflictFarm.spec.d.ts +15 -0
- package/dist/test/client.conflictFarm.spec.d.ts.map +1 -0
- package/dist/test/client.conflictFarm.spec.js +88 -0
- package/dist/test/client.conflictFarm.spec.js.map +1 -0
- package/dist/test/client.getPosition.spec.d.ts +6 -0
- package/dist/test/client.getPosition.spec.d.ts.map +1 -0
- package/dist/test/client.getPosition.spec.js +54 -0
- package/dist/test/client.getPosition.spec.js.map +1 -0
- package/dist/test/client.localReference.spec.d.ts +6 -0
- package/dist/test/client.localReference.spec.d.ts.map +1 -0
- package/dist/test/client.localReference.spec.js +439 -0
- package/dist/test/client.localReference.spec.js.map +1 -0
- package/dist/test/client.localReferenceFarm.spec.d.ts +6 -0
- package/dist/test/client.localReferenceFarm.spec.d.ts.map +1 -0
- package/dist/test/client.localReferenceFarm.spec.js +88 -0
- package/dist/test/client.localReferenceFarm.spec.js.map +1 -0
- package/dist/test/client.rebasePosition.spec.d.ts +6 -0
- package/dist/test/client.rebasePosition.spec.d.ts.map +1 -0
- package/dist/test/client.rebasePosition.spec.js +102 -0
- package/dist/test/client.rebasePosition.spec.js.map +1 -0
- package/dist/test/client.reconnectFarm.spec.d.ts +12 -0
- package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -0
- package/dist/test/client.reconnectFarm.spec.js +91 -0
- package/dist/test/client.reconnectFarm.spec.js.map +1 -0
- package/dist/test/client.replay.spec.d.ts +6 -0
- package/dist/test/client.replay.spec.d.ts.map +1 -0
- package/dist/test/client.replay.spec.js +85 -0
- package/dist/test/client.replay.spec.js.map +1 -0
- package/dist/test/client.rollback.spec.d.ts +6 -0
- package/dist/test/client.rollback.spec.d.ts.map +1 -0
- package/dist/test/client.rollback.spec.js +453 -0
- package/dist/test/client.rollback.spec.js.map +1 -0
- package/dist/test/client.rollbackFarm.spec.d.ts +6 -0
- package/dist/test/client.rollbackFarm.spec.d.ts.map +1 -0
- package/dist/test/client.rollbackFarm.spec.js +48 -0
- package/dist/test/client.rollbackFarm.spec.js.map +1 -0
- package/dist/test/client.searchForMarker.spec.d.ts +6 -0
- package/dist/test/client.searchForMarker.spec.d.ts.map +1 -0
- package/dist/test/client.searchForMarker.spec.js +446 -0
- package/dist/test/client.searchForMarker.spec.js.map +1 -0
- package/dist/test/client.walkSegments.spec.d.ts +6 -0
- package/dist/test/client.walkSegments.spec.d.ts.map +1 -0
- package/dist/test/client.walkSegments.spec.js +54 -0
- package/dist/test/client.walkSegments.spec.js.map +1 -0
- package/dist/test/collections.list.spec.d.ts +6 -0
- package/dist/test/collections.list.spec.d.ts.map +1 -0
- package/dist/test/collections.list.spec.js +84 -0
- package/dist/test/collections.list.spec.js.map +1 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js +35 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
- package/dist/test/index.d.ts +13 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +88 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js +142 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.annotate.spec.d.ts +6 -0
- package/dist/test/mergeTree.annotate.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.annotate.spec.js +448 -0
- package/dist/test/mergeTree.annotate.spec.js.map +1 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.js +126 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.insertingWalk.spec.d.ts +6 -0
- package/dist/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.insertingWalk.spec.js +279 -0
- package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +178 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.js +130 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
- package/dist/test/mergeTree.walk.spec.d.ts +6 -0
- package/dist/test/mergeTree.walk.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.walk.spec.js +63 -0
- package/dist/test/mergeTree.walk.spec.js.map +1 -0
- package/dist/test/mergeTree.zamboni.spec.d.ts +6 -0
- package/dist/test/mergeTree.zamboni.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.zamboni.spec.js +52 -0
- package/dist/test/mergeTree.zamboni.spec.js.map +1 -0
- package/dist/test/mergeTreeOperationRunner.d.ts +63 -0
- package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -0
- package/dist/test/mergeTreeOperationRunner.js +245 -0
- package/dist/test/mergeTreeOperationRunner.js.map +1 -0
- package/dist/test/mergeTreeOperationRunner.spec.d.ts +6 -0
- package/dist/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
- package/dist/test/mergeTreeOperationRunner.spec.js +156 -0
- package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -0
- package/dist/test/obliterate.concurrent.spec.d.ts +6 -0
- package/dist/test/obliterate.concurrent.spec.d.ts.map +1 -0
- package/dist/test/obliterate.concurrent.spec.js +1446 -0
- package/dist/test/obliterate.concurrent.spec.js.map +1 -0
- package/dist/test/obliterate.partialLength.spec.d.ts +6 -0
- package/dist/test/obliterate.partialLength.spec.d.ts.map +1 -0
- package/dist/test/obliterate.partialLength.spec.js +279 -0
- package/dist/test/obliterate.partialLength.spec.js.map +1 -0
- package/dist/test/obliterate.reconnect.spec.d.ts +6 -0
- package/dist/test/obliterate.reconnect.spec.d.ts.map +1 -0
- package/dist/test/obliterate.reconnect.spec.js +164 -0
- package/dist/test/obliterate.reconnect.spec.js.map +1 -0
- package/dist/test/obliterate.spec.d.ts +6 -0
- package/dist/test/obliterate.spec.d.ts.map +1 -0
- package/dist/test/obliterate.spec.js +162 -0
- package/dist/test/obliterate.spec.js.map +1 -0
- package/dist/test/ordinal.spec.d.ts +2 -0
- package/dist/test/ordinal.spec.d.ts.map +1 -0
- package/dist/test/ordinal.spec.js +43 -0
- package/dist/test/ordinal.spec.js.map +1 -0
- package/dist/test/partialLength.spec.d.ts +6 -0
- package/dist/test/partialLength.spec.d.ts.map +1 -0
- package/dist/test/partialLength.spec.js +282 -0
- package/dist/test/partialLength.spec.js.map +1 -0
- package/dist/test/properties.spec.d.ts +6 -0
- package/dist/test/properties.spec.d.ts.map +1 -0
- package/dist/test/properties.spec.js +55 -0
- package/dist/test/properties.spec.js.map +1 -0
- package/dist/test/reconnectHelper.d.ts +48 -0
- package/dist/test/reconnectHelper.d.ts.map +1 -0
- package/dist/test/reconnectHelper.js +86 -0
- package/dist/test/reconnectHelper.js.map +1 -0
- package/dist/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
- package/dist/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
- package/dist/test/resetPendingSegmentsToOp.spec.js +218 -0
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -0
- package/dist/test/revertibleFarm.spec.d.ts +6 -0
- package/dist/test/revertibleFarm.spec.d.ts.map +1 -0
- package/dist/test/revertibleFarm.spec.js +124 -0
- package/dist/test/revertibleFarm.spec.js.map +1 -0
- package/dist/test/revertibles.spec.d.ts +17 -0
- package/dist/test/revertibles.spec.d.ts.map +1 -0
- package/dist/test/revertibles.spec.js +385 -0
- package/dist/test/revertibles.spec.js.map +1 -0
- package/dist/test/segmentGroupCollection.spec.d.ts +6 -0
- package/dist/test/segmentGroupCollection.spec.d.ts.map +1 -0
- package/dist/test/segmentGroupCollection.spec.js +60 -0
- package/dist/test/segmentGroupCollection.spec.js.map +1 -0
- package/dist/test/snapshot.spec.d.ts +6 -0
- package/dist/test/snapshot.spec.d.ts.map +1 -0
- package/dist/test/snapshot.spec.js +178 -0
- package/dist/test/snapshot.spec.js.map +1 -0
- package/dist/test/snapshot.utils.d.ts +33 -0
- package/dist/test/snapshot.utils.d.ts.map +1 -0
- package/dist/test/snapshot.utils.js +109 -0
- package/dist/test/snapshot.utils.js.map +1 -0
- package/dist/test/snapshotlegacy.spec.d.ts +6 -0
- package/dist/test/snapshotlegacy.spec.d.ts.map +1 -0
- package/dist/test/snapshotlegacy.spec.js +139 -0
- package/dist/test/snapshotlegacy.spec.js.map +1 -0
- package/dist/test/sortedSegmentSet.spec.d.ts +6 -0
- package/dist/test/sortedSegmentSet.spec.d.ts.map +1 -0
- package/dist/test/sortedSegmentSet.spec.js +95 -0
- package/dist/test/sortedSegmentSet.spec.js.map +1 -0
- package/dist/test/testClient.d.ts +119 -0
- package/dist/test/testClient.d.ts.map +1 -0
- package/dist/test/testClient.js +439 -0
- package/dist/test/testClient.js.map +1 -0
- package/dist/test/testClientLogger.d.ts +44 -0
- package/dist/test/testClientLogger.d.ts.map +1 -0
- package/dist/test/testClientLogger.js +287 -0
- package/dist/test/testClientLogger.js.map +1 -0
- package/dist/test/testSerializer.d.ts +18 -0
- package/dist/test/testSerializer.d.ts.map +1 -0
- package/dist/test/testSerializer.js +33 -0
- package/dist/test/testSerializer.js.map +1 -0
- package/dist/test/testServer.d.ts +36 -0
- package/dist/test/testServer.d.ts.map +1 -0
- package/dist/test/testServer.js +138 -0
- package/dist/test/testServer.js.map +1 -0
- package/dist/test/testUtils.d.ts +69 -0
- package/dist/test/testUtils.d.ts.map +1 -0
- package/dist/test/testUtils.js +149 -0
- package/dist/test/testUtils.js.map +1 -0
- package/dist/test/text.d.ts +9 -0
- package/dist/test/text.d.ts.map +1 -0
- package/dist/test/text.js +76 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/tracking.spec.d.ts +6 -0
- package/dist/test/tracking.spec.d.ts.map +1 -0
- package/dist/test/tracking.spec.js +120 -0
- package/dist/test/tracking.spec.js.map +1 -0
- package/dist/test/wordUnitTests.d.ts +6 -0
- package/dist/test/wordUnitTests.d.ts.map +1 -0
- package/dist/test/wordUnitTests.js +172 -0
- package/dist/test/wordUnitTests.js.map +1 -0
- package/lib/{MergeTreeTextHelper.d.ts → MergeTreeTextHelper.d.mts} +3 -3
- package/lib/MergeTreeTextHelper.d.mts.map +1 -0
- package/lib/{MergeTreeTextHelper.js → MergeTreeTextHelper.mjs} +5 -10
- package/lib/MergeTreeTextHelper.mjs.map +1 -0
- package/lib/{attributionCollection.d.ts → attributionCollection.d.mts} +2 -2
- package/lib/attributionCollection.d.mts.map +1 -0
- package/lib/{attributionCollection.js → attributionCollection.mjs} +9 -14
- package/lib/attributionCollection.mjs.map +1 -0
- package/lib/{attributionPolicy.d.ts → attributionPolicy.d.mts} +2 -2
- package/lib/attributionPolicy.d.mts.map +1 -0
- package/lib/{attributionPolicy.js → attributionPolicy.mjs} +21 -27
- package/lib/attributionPolicy.mjs.map +1 -0
- package/lib/{client.d.ts → client.d.mts} +9 -16
- package/lib/client.d.mts.map +1 -0
- package/lib/{client.js → client.mjs} +101 -110
- package/lib/client.mjs.map +1 -0
- package/lib/collections/{index.d.ts → index.d.mts} +3 -3
- package/lib/collections/index.d.mts.map +1 -0
- package/lib/collections/index.mjs +7 -0
- package/lib/collections/index.mjs.map +1 -0
- package/lib/collections/{list.d.ts → list.d.mts} +1 -1
- package/lib/collections/list.d.mts.map +1 -0
- package/lib/collections/{list.js → list.mjs} +6 -11
- package/lib/collections/list.mjs.map +1 -0
- package/lib/collections/{rbTree.d.ts → rbTree.d.mts} +1 -1
- package/lib/collections/rbTree.d.mts.map +1 -0
- package/lib/collections/{rbTree.js → rbTree.mjs} +16 -20
- package/lib/collections/rbTree.mjs.map +1 -0
- package/lib/{constants.d.ts → constants.d.mts} +1 -1
- package/lib/constants.d.mts.map +1 -0
- package/lib/constants.mjs +32 -0
- package/lib/constants.mjs.map +1 -0
- package/lib/{endOfTreeSegment.d.ts → endOfTreeSegment.d.mts} +4 -4
- package/lib/endOfTreeSegment.d.mts.map +1 -0
- package/lib/{endOfTreeSegment.js → endOfTreeSegment.mjs} +13 -18
- package/lib/endOfTreeSegment.mjs.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +21 -21
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +24 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{localReference.d.ts → localReference.d.mts} +7 -7
- package/lib/localReference.d.mts.map +1 -0
- package/lib/{localReference.js → localReference.mjs} +38 -47
- package/lib/localReference.mjs.map +1 -0
- package/lib/{merge-tree-alpha.d.ts → merge-tree-alpha.d.mts} +27 -12
- package/lib/{merge-tree-beta.d.ts → merge-tree-beta.d.mts} +0 -16
- package/lib/{merge-tree-public.d.ts → merge-tree-public.d.mts} +0 -16
- package/lib/{merge-tree-untrimmed.d.ts → merge-tree-untrimmed.d.mts} +5 -29
- package/lib/{mergeTree.d.ts → mergeTree.d.mts} +12 -29
- package/lib/mergeTree.d.mts.map +1 -0
- package/lib/{mergeTree.js → mergeTree.mjs} +203 -340
- package/lib/mergeTree.mjs.map +1 -0
- package/lib/{mergeTreeDeltaCallback.d.ts → mergeTreeDeltaCallback.d.mts} +4 -8
- package/lib/mergeTreeDeltaCallback.d.mts.map +1 -0
- package/lib/{mergeTreeDeltaCallback.js → mergeTreeDeltaCallback.mjs} +2 -5
- package/lib/mergeTreeDeltaCallback.mjs.map +1 -0
- package/lib/{mergeTreeNodeWalk.d.ts → mergeTreeNodeWalk.d.mts} +2 -2
- package/lib/mergeTreeNodeWalk.d.mts.map +1 -0
- package/lib/{mergeTreeNodeWalk.js → mergeTreeNodeWalk.mjs} +14 -21
- package/lib/mergeTreeNodeWalk.mjs.map +1 -0
- package/lib/{mergeTreeNodes.d.ts → mergeTreeNodes.d.mts} +12 -12
- package/lib/mergeTreeNodes.d.mts.map +1 -0
- package/lib/{mergeTreeNodes.js → mergeTreeNodes.mjs} +60 -76
- package/lib/mergeTreeNodes.mjs.map +1 -0
- package/lib/{mergeTreeTracking.d.ts → mergeTreeTracking.d.mts} +3 -3
- package/lib/mergeTreeTracking.d.mts.map +1 -0
- package/lib/{mergeTreeTracking.js → mergeTreeTracking.mjs} +6 -13
- package/lib/mergeTreeTracking.mjs.map +1 -0
- package/lib/{opBuilder.d.ts → opBuilder.d.mts} +4 -4
- package/lib/opBuilder.d.mts.map +1 -0
- package/lib/{opBuilder.js → opBuilder.mjs} +15 -25
- package/lib/opBuilder.mjs.map +1 -0
- package/lib/{ops.d.ts → ops.d.mts} +2 -2
- package/lib/ops.d.mts.map +1 -0
- package/lib/{ops.js → ops.mjs} +5 -8
- package/lib/ops.mjs.map +1 -0
- package/lib/{ordinal.d.ts → ordinal.d.mts} +1 -1
- package/lib/ordinal.d.mts.map +1 -0
- package/lib/{ordinal.js → ordinal.mjs} +4 -9
- package/lib/ordinal.mjs.map +1 -0
- package/lib/{partialLengths.d.ts → partialLengths.d.mts} +4 -4
- package/lib/partialLengths.d.mts.map +1 -0
- package/lib/{partialLengths.js → partialLengths.mjs} +38 -46
- package/lib/partialLengths.mjs.map +1 -0
- package/lib/{properties.d.ts → properties.d.mts} +1 -1
- package/lib/properties.d.mts.map +1 -0
- package/lib/{properties.js → properties.mjs} +7 -16
- package/lib/properties.mjs.map +1 -0
- package/lib/{referencePositions.d.ts → referencePositions.d.mts} +5 -5
- package/lib/referencePositions.d.mts.map +1 -0
- package/lib/referencePositions.mjs +70 -0
- package/lib/referencePositions.mjs.map +1 -0
- package/lib/{revertibles.d.ts → revertibles.d.mts} +12 -12
- package/lib/revertibles.d.mts.map +1 -0
- package/lib/{revertibles.js → revertibles.mjs} +60 -67
- package/lib/revertibles.mjs.map +1 -0
- package/lib/{segmentGroupCollection.d.ts → segmentGroupCollection.d.mts} +2 -2
- package/lib/segmentGroupCollection.d.mts.map +1 -0
- package/lib/{segmentGroupCollection.js → segmentGroupCollection.mjs} +5 -9
- package/lib/segmentGroupCollection.mjs.map +1 -0
- package/lib/{segmentPropertiesManager.d.ts → segmentPropertiesManager.d.mts} +3 -3
- package/lib/segmentPropertiesManager.d.mts.map +1 -0
- package/lib/{segmentPropertiesManager.js → segmentPropertiesManager.mjs} +14 -20
- package/lib/{segmentPropertiesManager.js.map → segmentPropertiesManager.mjs.map} +1 -1
- package/lib/{snapshotChunks.d.ts → snapshotChunks.d.mts} +4 -4
- package/lib/snapshotChunks.d.mts.map +1 -0
- package/lib/{snapshotChunks.js → snapshotChunks.mjs} +10 -17
- package/lib/snapshotChunks.mjs.map +1 -0
- package/lib/{snapshotLoader.d.ts → snapshotLoader.d.mts} +3 -3
- package/lib/snapshotLoader.d.mts.map +1 -0
- package/lib/{snapshotLoader.js → snapshotLoader.mjs} +33 -38
- package/lib/snapshotLoader.mjs.map +1 -0
- package/lib/{snapshotV1.d.ts → snapshotV1.d.mts} +4 -4
- package/lib/snapshotV1.d.mts.map +1 -0
- package/lib/{snapshotV1.js → snapshotV1.mjs} +28 -32
- package/lib/snapshotV1.mjs.map +1 -0
- package/lib/{snapshotlegacy.d.ts → snapshotlegacy.d.mts} +3 -3
- package/lib/snapshotlegacy.d.mts.map +1 -0
- package/lib/{snapshotlegacy.js → snapshotlegacy.mjs} +21 -26
- package/lib/snapshotlegacy.mjs.map +1 -0
- package/lib/{sortedSegmentSet.d.ts → sortedSegmentSet.d.mts} +4 -4
- package/lib/sortedSegmentSet.d.mts.map +1 -0
- package/lib/{sortedSegmentSet.js → sortedSegmentSet.mjs} +3 -8
- package/lib/sortedSegmentSet.mjs.map +1 -0
- package/lib/{sortedSet.d.ts → sortedSet.d.mts} +1 -1
- package/lib/sortedSet.d.mts.map +1 -0
- package/lib/{sortedSet.js → sortedSet.mjs} +2 -6
- package/lib/sortedSet.mjs.map +1 -0
- package/lib/{textSegment.d.ts → textSegment.d.mts} +4 -4
- package/lib/textSegment.d.mts.map +1 -0
- package/lib/{textSegment.js → textSegment.mjs} +8 -12
- package/lib/textSegment.mjs.map +1 -0
- package/lib/{zamboni.d.ts → zamboni.d.mts} +3 -3
- package/lib/zamboni.d.mts.map +1 -0
- package/lib/{zamboni.js → zamboni.mjs} +22 -28
- package/lib/zamboni.mjs.map +1 -0
- package/package.json +95 -164
- package/src/client.ts +0 -8
- package/src/mergeTree.ts +0 -226
- package/src/ops.ts +1 -1
- package/src/revertibles.ts +4 -4
- package/lib/MergeTreeTextHelper.d.ts.map +0 -1
- package/lib/MergeTreeTextHelper.js.map +0 -1
- package/lib/attributionCollection.d.ts.map +0 -1
- package/lib/attributionCollection.js.map +0 -1
- package/lib/attributionPolicy.d.ts.map +0 -1
- package/lib/attributionPolicy.js.map +0 -1
- package/lib/client.d.ts.map +0 -1
- package/lib/client.js.map +0 -1
- package/lib/collections/index.d.ts.map +0 -1
- package/lib/collections/index.js +0 -14
- package/lib/collections/index.js.map +0 -1
- package/lib/collections/list.d.ts.map +0 -1
- package/lib/collections/list.js.map +0 -1
- package/lib/collections/rbTree.d.ts.map +0 -1
- package/lib/collections/rbTree.js.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js +0 -35
- package/lib/constants.js.map +0 -1
- package/lib/endOfTreeSegment.d.ts.map +0 -1
- package/lib/endOfTreeSegment.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -80
- package/lib/index.js.map +0 -1
- package/lib/localReference.d.ts.map +0 -1
- package/lib/localReference.js.map +0 -1
- package/lib/mergeTree.d.ts.map +0 -1
- package/lib/mergeTree.js.map +0 -1
- package/lib/mergeTreeDeltaCallback.d.ts.map +0 -1
- package/lib/mergeTreeDeltaCallback.js.map +0 -1
- package/lib/mergeTreeNodeWalk.d.ts.map +0 -1
- package/lib/mergeTreeNodeWalk.js.map +0 -1
- package/lib/mergeTreeNodes.d.ts.map +0 -1
- package/lib/mergeTreeNodes.js.map +0 -1
- package/lib/mergeTreeTracking.d.ts.map +0 -1
- package/lib/mergeTreeTracking.js.map +0 -1
- package/lib/opBuilder.d.ts.map +0 -1
- package/lib/opBuilder.js.map +0 -1
- package/lib/ops.d.ts.map +0 -1
- package/lib/ops.js.map +0 -1
- package/lib/ordinal.d.ts.map +0 -1
- package/lib/ordinal.js.map +0 -1
- package/lib/partialLengths.d.ts.map +0 -1
- package/lib/partialLengths.js.map +0 -1
- package/lib/properties.d.ts.map +0 -1
- package/lib/properties.js.map +0 -1
- package/lib/referencePositions.d.ts.map +0 -1
- package/lib/referencePositions.js +0 -80
- package/lib/referencePositions.js.map +0 -1
- package/lib/revertibles.d.ts.map +0 -1
- package/lib/revertibles.js.map +0 -1
- package/lib/segmentGroupCollection.d.ts.map +0 -1
- package/lib/segmentGroupCollection.js.map +0 -1
- package/lib/segmentPropertiesManager.d.ts.map +0 -1
- package/lib/snapshotChunks.d.ts.map +0 -1
- package/lib/snapshotChunks.js.map +0 -1
- package/lib/snapshotLoader.d.ts.map +0 -1
- package/lib/snapshotLoader.js.map +0 -1
- package/lib/snapshotV1.d.ts.map +0 -1
- package/lib/snapshotV1.js.map +0 -1
- package/lib/snapshotlegacy.d.ts.map +0 -1
- package/lib/snapshotlegacy.js.map +0 -1
- package/lib/sortedSegmentSet.d.ts.map +0 -1
- package/lib/sortedSegmentSet.js.map +0 -1
- package/lib/sortedSet.d.ts.map +0 -1
- package/lib/sortedSet.js.map +0 -1
- package/lib/textSegment.d.ts.map +0 -1
- package/lib/textSegment.js.map +0 -1
- package/lib/zamboni.d.ts.map +0 -1
- package/lib/zamboni.js.map +0 -1
- package/merge-tree.test-files.tar +0 -0
- package/src/mergeTreeExample1.pdf +0 -0
- package/tsconfig.esnext.json +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,gCAA4C;AAC5C,gDAA6F;AAC7F,2CAA+C;AAC/C,qDAA4D;AAE5D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAO,CAAC;IAEZ,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,sEAAsE;QACtE,uEAAuE;QACvE,UAAU;QACV,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACvB;YAED,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;KACD,CAAC,CAAC;IAEH,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,KAAK,EAAE,kCAAkC;QACzC,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IA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J,CAAC;KACD,CAAC,CAAC;IAEH,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,KAAK,EAAE,0BAA0B;QACjC,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACvB;YAED,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,GAAG,GAAG,MAAM,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC;YAExC,IAAA,4BAAgB,EAAC;gBAChB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC;gBACX,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,wBAAkB,CAAC,MAAM,EAAE,EAAE;gBACnD,SAAS,EAAE,KAAK;aAChB,CAAC,CAAC;QACJ,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 { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { MergeTreeDeltaType } from \"../ops\";\nimport { appendToMergeTreeDeltaRevertibles, MergeTreeDeltaRevertible } from \"../revertibles\";\nimport { markRangeRemoved } from \"./testUtils\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary;\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\t// baseline summary benchmark to compare to other remove tests. such a\n\t\t// comparison should give a (rough) sense of overhead caused by summary\n\t\t// loading\n\t\ttitle: \"baseline summary load\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tawait loadSnapshot(summary);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove large range of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tfor (const length of [10, 100, 1000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: \"remove large range of large tree with undo-redo\",\n\t\t\tcategory: \"remove\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < length / 2; i++) {\n\t\t\t\t\tstr.append(\"a\", true);\n\t\t\t\t\tstr.appendMarker(true);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\t\tconst revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\tstr.on(\"delta\", (_op, delta) => {\n\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, revertibles);\n\t\t\t\t});\n\n\t\t\t\tconst op = str.removeRangeLocal(0, length - 1);\n\t\t\t\tstr.applyMsg(\n\t\t\t\t\tstr.makeOpMessage(\n\t\t\t\t\t\top,\n\t\t\t\t\t\t/* seq */ length + 1,\n\t\t\t\t\t\t/* refSeq */ length,\n\t\t\t\t\t\tstr.longClientId,\n\t\t\t\t\t\t/* minSeq */ length,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove start of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove middle of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 499,\n\t\t\t\tend: 501,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove end of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 999,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Snapshot.perf.spec.d.ts","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const benchmark_1 = require("@fluid-tools/benchmark");
|
|
8
|
+
const snapshot_utils_1 = require("./snapshot.utils");
|
|
9
|
+
describe("MergeTree snapshots", () => {
|
|
10
|
+
let summary;
|
|
11
|
+
for (const summarySize of [10, 50, 100, 500, 1000, 5000, 10000]) {
|
|
12
|
+
(0, benchmark_1.benchmark)({
|
|
13
|
+
type: benchmark_1.BenchmarkType.Measurement,
|
|
14
|
+
title: `load snapshot with ${summarySize} segments`,
|
|
15
|
+
category: "snapshot loading",
|
|
16
|
+
before: () => {
|
|
17
|
+
const str = new snapshot_utils_1.TestString("id", {});
|
|
18
|
+
for (let i = 0; i < summarySize; i++) {
|
|
19
|
+
str.append("a", false);
|
|
20
|
+
}
|
|
21
|
+
str.applyPendingOps();
|
|
22
|
+
summary = str.getSummary();
|
|
23
|
+
},
|
|
24
|
+
benchmarkFnAsync: async () => {
|
|
25
|
+
await (0, snapshot_utils_1.loadSnapshot)(summary);
|
|
26
|
+
},
|
|
27
|
+
after: () => {
|
|
28
|
+
summary = undefined;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=Snapshot.perf.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,qDAA4D;AAE5D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAO,CAAC;IAEZ,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAK,EAAE,KAAM,CAAC,EAAE;QAClE,IAAA,qBAAS,EAAC;YACT,IAAI,EAAE,yBAAa,CAAC,WAAW;YAC/B,KAAK,EAAE,sBAAsB,WAAW,WAAW;YACnD,QAAQ,EAAE,kBAAkB;YAC5B,MAAM,EAAE,GAAG,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;oBACrC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBACvB;gBAED,GAAG,CAAC,eAAe,EAAE,CAAC;gBACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,SAAS,CAAC;YACrB,CAAC;SACD,CAAC,CAAC;KACH;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils\";\n\ndescribe(\"MergeTree snapshots\", () => {\n\tlet summary;\n\n\tfor (const summarySize of [10, 50, 100, 500, 1000, 5_000, 10_000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: `load snapshot with ${summarySize} segments`,\n\t\t\tcategory: \"snapshot loading\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < summarySize; i++) {\n\t\t\t\t\tstr.append(\"a\", false);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tawait loadSnapshot(summary);\n\t\t\t},\n\t\t\tafter: () => {\n\t\t\t\tsummary = undefined;\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributionCollection.perf.spec.d.ts","sourceRoot":"","sources":["../../src/test/attributionCollection.perf.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const assert_1 = require("assert");
|
|
8
|
+
const benchmark_1 = require("@fluid-tools/benchmark");
|
|
9
|
+
const attributionCollection_1 = require("../attributionCollection");
|
|
10
|
+
const textSegment_1 = require("../textSegment");
|
|
11
|
+
const mergeTreeNodes_1 = require("../mergeTreeNodes");
|
|
12
|
+
const collections_1 = require("../collections");
|
|
13
|
+
function getCollectionSizes(ctor, baseSuiteType) {
|
|
14
|
+
const singleKeyCollection = new ctor(5, { type: "op", seq: 42 });
|
|
15
|
+
const tenKeyCollection = new ctor(2, { type: "op", seq: 0 });
|
|
16
|
+
for (let i = 1; i < 10; i++) {
|
|
17
|
+
tenKeyCollection.append(new ctor(3 * i, { type: "op", seq: i }));
|
|
18
|
+
}
|
|
19
|
+
const maxSizeCollection = new ctor(1, { type: "op", seq: 0 });
|
|
20
|
+
for (let i = 1; i < textSegment_1.TextSegmentGranularity; i++) {
|
|
21
|
+
maxSizeCollection.append(new ctor(1, { type: "op", seq: i }));
|
|
22
|
+
}
|
|
23
|
+
return [
|
|
24
|
+
{ name: "one key", collection: singleKeyCollection, type: benchmark_1.BenchmarkType.Diagnostic },
|
|
25
|
+
{ name: "ten keys", collection: tenKeyCollection, type: baseSuiteType },
|
|
26
|
+
{ name: "maximum keys", collection: maxSizeCollection, type: benchmark_1.BenchmarkType.Diagnostic },
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
function runAttributionCollectionSuite(ctor, suiteBaseType) {
|
|
30
|
+
const collectionTestCases = getCollectionSizes(ctor, suiteBaseType);
|
|
31
|
+
for (const { name, collection, type } of collectionTestCases) {
|
|
32
|
+
describe(`using a collection with ${name}`, () => {
|
|
33
|
+
const { length } = collection;
|
|
34
|
+
(0, benchmark_1.benchmark)({
|
|
35
|
+
title: "getAtOffset at the start",
|
|
36
|
+
benchmarkFn: () => collection.getAtOffset(0),
|
|
37
|
+
type,
|
|
38
|
+
});
|
|
39
|
+
(0, benchmark_1.benchmark)({
|
|
40
|
+
title: "getAtOffset at the end",
|
|
41
|
+
benchmarkFn: () => collection.getAtOffset(length - 1),
|
|
42
|
+
type,
|
|
43
|
+
});
|
|
44
|
+
(0, benchmark_1.benchmark)({
|
|
45
|
+
title: "getAtOffset in the middle",
|
|
46
|
+
benchmarkFn: () => collection.getAtOffset(length / 2),
|
|
47
|
+
type: benchmark_1.BenchmarkType.Diagnostic,
|
|
48
|
+
});
|
|
49
|
+
(0, benchmark_1.benchmark)({
|
|
50
|
+
title: "getAll",
|
|
51
|
+
benchmarkFn: () => collection.getAll(),
|
|
52
|
+
type,
|
|
53
|
+
});
|
|
54
|
+
(0, benchmark_1.benchmark)({
|
|
55
|
+
title: "clone",
|
|
56
|
+
benchmarkFn: () => collection.clone(),
|
|
57
|
+
type,
|
|
58
|
+
});
|
|
59
|
+
(0, benchmark_1.benchmark)({
|
|
60
|
+
title: "split + append in the middle",
|
|
61
|
+
benchmarkFn: () => {
|
|
62
|
+
const split = collection.splitAt(length / 2);
|
|
63
|
+
collection.append(split);
|
|
64
|
+
},
|
|
65
|
+
type,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
(0, benchmark_1.benchmark)({
|
|
70
|
+
title: "construction",
|
|
71
|
+
benchmarkFn: () => new ctor(42, { type: "op", seq: 5 }),
|
|
72
|
+
type: suiteBaseType,
|
|
73
|
+
});
|
|
74
|
+
const segmentsToSerialize = collectionTestCases.map(({ collection }) => ({
|
|
75
|
+
attribution: collection,
|
|
76
|
+
cachedLength: collection.length,
|
|
77
|
+
}));
|
|
78
|
+
(0, benchmark_1.benchmark)({
|
|
79
|
+
title: "serializing",
|
|
80
|
+
benchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),
|
|
81
|
+
type: suiteBaseType,
|
|
82
|
+
});
|
|
83
|
+
const summary = ctor.serializeAttributionCollections(segmentsToSerialize);
|
|
84
|
+
const segments = Array.from({ length: 9 }, () => ({
|
|
85
|
+
cachedLength: Math.floor(summary.length / 10),
|
|
86
|
+
}));
|
|
87
|
+
segments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) });
|
|
88
|
+
(0, benchmark_1.benchmark)({
|
|
89
|
+
title: "deserialize into 10 segments",
|
|
90
|
+
benchmarkFn: () => {
|
|
91
|
+
ctor.populateAttributionCollections(segments, summary);
|
|
92
|
+
},
|
|
93
|
+
type: suiteBaseType,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Note: channel functionality is left unimplemented.
|
|
97
|
+
class TreeAttributionCollection {
|
|
98
|
+
constructor(_length,
|
|
99
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
100
|
+
baseEntry) {
|
|
101
|
+
this._length = _length;
|
|
102
|
+
this.entries = new collections_1.RedBlackTree(mergeTreeNodes_1.compareNumbers);
|
|
103
|
+
if (baseEntry !== undefined) {
|
|
104
|
+
this.entries.put(0, baseEntry);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
get channelNames() {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
getAtOffset(offset) {
|
|
111
|
+
(0, assert_1.strict)(offset >= 0 && offset < this._length, "Requested offset should be valid");
|
|
112
|
+
const node = this.entries.floor(offset);
|
|
113
|
+
(0, assert_1.strict)(node !== undefined, "Collection should have at least one entry");
|
|
114
|
+
return node.data ?? undefined;
|
|
115
|
+
}
|
|
116
|
+
get length() {
|
|
117
|
+
return this._length;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Splits this attribution collection into two with entries for [0, pos) and [pos, length).
|
|
121
|
+
*/
|
|
122
|
+
splitAt(pos) {
|
|
123
|
+
const splitBaseEntry = this.getAtOffset(pos);
|
|
124
|
+
const splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);
|
|
125
|
+
for (let current = this.entries.ceil(pos); current !== undefined; current = this.entries.ceil(pos)) {
|
|
126
|
+
// If there happened to be an attribution change at exactly pos, it's already set in the base entry
|
|
127
|
+
if (current.key !== pos) {
|
|
128
|
+
splitCollection.entries.put(current.key - pos, current.data);
|
|
129
|
+
}
|
|
130
|
+
this.entries.remove(current.key);
|
|
131
|
+
}
|
|
132
|
+
this._length = pos;
|
|
133
|
+
return splitCollection;
|
|
134
|
+
}
|
|
135
|
+
append(other) {
|
|
136
|
+
const lastEntry = this.getAtOffset(this.length - 1);
|
|
137
|
+
other.entries.map(({ key, data }) => {
|
|
138
|
+
if (key !== 0 || !(0, attributionCollection_1.areEqualAttributionKeys)(lastEntry, data)) {
|
|
139
|
+
this.entries.put(key + this.length, data);
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
});
|
|
143
|
+
this._length += other.length;
|
|
144
|
+
}
|
|
145
|
+
getAll() {
|
|
146
|
+
const results = [];
|
|
147
|
+
this.entries.map(({ key, data }) => {
|
|
148
|
+
results.push({ offset: key, key: data });
|
|
149
|
+
return true;
|
|
150
|
+
});
|
|
151
|
+
return { root: results, length: this.length };
|
|
152
|
+
}
|
|
153
|
+
clone() {
|
|
154
|
+
const copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));
|
|
155
|
+
this.entries.map(({ key, data }) => {
|
|
156
|
+
copy.entries.put(key, data);
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
return copy;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.
|
|
163
|
+
*/
|
|
164
|
+
static populateAttributionCollections(segments, summary) {
|
|
165
|
+
const { seqs, posBreakpoints } = summary;
|
|
166
|
+
(0, assert_1.strict)(seqs.length === posBreakpoints.length && seqs.length > 0, "Invalid attribution summary blob provided");
|
|
167
|
+
let curIndex = 0;
|
|
168
|
+
let cumulativeSegPos = 0;
|
|
169
|
+
let currentInfo = seqs[curIndex];
|
|
170
|
+
const getCurrentKey = () => typeof currentInfo === "object"
|
|
171
|
+
? currentInfo
|
|
172
|
+
: { type: "op", seq: currentInfo };
|
|
173
|
+
for (const segment of segments) {
|
|
174
|
+
const attribution = new TreeAttributionCollection(segment.cachedLength, getCurrentKey());
|
|
175
|
+
while (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {
|
|
176
|
+
currentInfo = seqs[curIndex];
|
|
177
|
+
attribution.entries.put(posBreakpoints[curIndex] - cumulativeSegPos, getCurrentKey());
|
|
178
|
+
curIndex++;
|
|
179
|
+
}
|
|
180
|
+
segment.attribution = attribution;
|
|
181
|
+
cumulativeSegPos += segment.cachedLength;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
update() {
|
|
185
|
+
throw new Error("unimplemented");
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`
|
|
189
|
+
*/
|
|
190
|
+
static serializeAttributionCollections(segments) {
|
|
191
|
+
const posBreakpoints = [];
|
|
192
|
+
const seqs = [];
|
|
193
|
+
let mostRecentAttributionKey;
|
|
194
|
+
let cumulativePos = 0;
|
|
195
|
+
let segmentsWithAttribution = 0;
|
|
196
|
+
let segmentsWithoutAttribution = 0;
|
|
197
|
+
for (const segment of segments) {
|
|
198
|
+
if (segment.attribution) {
|
|
199
|
+
segmentsWithAttribution++;
|
|
200
|
+
for (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {
|
|
201
|
+
if (mostRecentAttributionKey === undefined ||
|
|
202
|
+
!(0, attributionCollection_1.areEqualAttributionKeys)(info, mostRecentAttributionKey)) {
|
|
203
|
+
posBreakpoints.push(offset + cumulativePos);
|
|
204
|
+
seqs.push(!info ? null : info.type === "op" ? info.seq : info);
|
|
205
|
+
}
|
|
206
|
+
mostRecentAttributionKey = info;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
segmentsWithoutAttribution++;
|
|
211
|
+
}
|
|
212
|
+
cumulativePos += segment.cachedLength;
|
|
213
|
+
}
|
|
214
|
+
(0, assert_1.strict)(segmentsWithAttribution === 0 || segmentsWithoutAttribution === 0, "Expected either all segments or no segments to have attribution information.");
|
|
215
|
+
const blobContents = {
|
|
216
|
+
seqs,
|
|
217
|
+
posBreakpoints,
|
|
218
|
+
length: cumulativePos,
|
|
219
|
+
};
|
|
220
|
+
return blobContents;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
describe("IAttributionCollection perf", () => {
|
|
224
|
+
describe("tree implementation", () => {
|
|
225
|
+
runAttributionCollectionSuite(TreeAttributionCollection, benchmark_1.BenchmarkType.Diagnostic);
|
|
226
|
+
});
|
|
227
|
+
describe("list-based implementation", () => {
|
|
228
|
+
runAttributionCollectionSuite(attributionCollection_1.AttributionCollection, benchmark_1.BenchmarkType.Measurement);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
//# sourceMappingURL=attributionCollection.perf.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources":["../../src/test/attributionCollection.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,mCAA0C;AAC1C,sDAAkE;AAElE,oEAMkC;AAClC,gDAAwD;AACxD,sDA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iBAChC;aACD;iBAAM;gBACN,0BAA0B,EAAE,CAAC;aAC7B;YAED,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;SACtC;QAED,IAAA,eAAM,EACL,uBAAuB,KAAK,CAAC,IAAI,0BAA0B,KAAK,CAAC,EACjE,8EAA8E,CAC9E,CAAC;QAEF,MAAM,YAAY,GAAoC;YACrD,IAAI;YACJ,cAAc;YACd,MAAM,EAAE,aAAa;SACrB,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpC,6BAA6B,CAAC,yBAAyB,EAAE,yBAAa,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,6BAA6B,CAAC,6CAAwB,EAAE,yBAAa,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,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 { strict as assert } from \"assert\";\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport {\n\tareEqualAttributionKeys,\n\tAttributionCollection as NewAttributionCollection,\n\tIAttributionCollection,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection\";\nimport { TextSegmentGranularity } from \"../textSegment\";\nimport { compareNumbers, ISegment } from \"../mergeTreeNodes\";\nimport { RedBlackTree } from \"../collections\";\n\ninterface IAttributionCollectionCtor {\n\tnew (length: number, key?: AttributionKey): IAttributionCollection<AttributionKey>;\n\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\nfunction getCollectionSizes(\n\tctor: IAttributionCollectionCtor,\n\tbaseSuiteType: BenchmarkType,\n): {\n\tname: string;\n\tcollection: IAttributionCollection<AttributionKey>;\n\ttype: BenchmarkType;\n}[] {\n\tconst singleKeyCollection = new ctor(5, { type: \"op\", seq: 42 });\n\tconst tenKeyCollection = new ctor(2, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < 10; i++) {\n\t\ttenKeyCollection.append(new ctor(3 * i, { type: \"op\", seq: i }));\n\t}\n\tconst maxSizeCollection = new ctor(1, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < TextSegmentGranularity; i++) {\n\t\tmaxSizeCollection.append(new ctor(1, { type: \"op\", seq: i }));\n\t}\n\treturn [\n\t\t{ name: \"one key\", collection: singleKeyCollection, type: BenchmarkType.Diagnostic },\n\t\t{ name: \"ten keys\", collection: tenKeyCollection, type: baseSuiteType },\n\t\t{ name: \"maximum keys\", collection: maxSizeCollection, type: BenchmarkType.Diagnostic },\n\t];\n}\n\nfunction runAttributionCollectionSuite(\n\tctor: IAttributionCollectionCtor,\n\tsuiteBaseType: BenchmarkType,\n): void {\n\tconst collectionTestCases = getCollectionSizes(ctor, suiteBaseType);\n\tfor (const { name, collection, type } of collectionTestCases) {\n\t\tdescribe(`using a collection with ${name}`, () => {\n\t\t\tconst { length } = collection;\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the start\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the end\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length - 1),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset in the middle\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length / 2),\n\t\t\t\ttype: BenchmarkType.Diagnostic,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAll\",\n\t\t\t\tbenchmarkFn: () => collection.getAll(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"clone\",\n\t\t\t\tbenchmarkFn: () => collection.clone(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"split + append in the middle\",\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\tconst split = collection.splitAt(length / 2);\n\t\t\t\t\tcollection.append(split);\n\t\t\t\t},\n\t\t\t\ttype,\n\t\t\t});\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttitle: \"construction\",\n\t\tbenchmarkFn: () => new ctor(42, { type: \"op\", seq: 5 }),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst segmentsToSerialize = collectionTestCases.map(({ collection }) => ({\n\t\tattribution: collection,\n\t\tcachedLength: collection.length,\n\t}));\n\n\tbenchmark({\n\t\ttitle: \"serializing\",\n\t\tbenchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst summary = ctor.serializeAttributionCollections(segmentsToSerialize);\n\tconst segments: ISegment[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) } as any);\n\tbenchmark({\n\t\ttitle: \"deserialize into 10 segments\",\n\t\tbenchmarkFn: () => {\n\t\t\tctor.populateAttributionCollections(segments, summary);\n\t\t},\n\t\ttype: suiteBaseType,\n\t});\n}\n\n// Note: channel functionality is left unimplemented.\nclass TreeAttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate readonly entries: RedBlackTree<number, AttributionKey | null> = new RedBlackTree(\n\t\tcompareNumbers,\n\t);\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.entries.put(0, baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames() {\n\t\treturn [];\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey | undefined {\n\t\tassert(offset >= 0 && offset < this._length, \"Requested offset should be valid\");\n\t\tconst node = this.entries.floor(offset);\n\t\tassert(node !== undefined, \"Collection should have at least one entry\");\n\t\treturn node.data ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): TreeAttributionCollection {\n\t\tconst splitBaseEntry = this.getAtOffset(pos);\n\t\tconst splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);\n\t\tfor (\n\t\t\tlet current = this.entries.ceil(pos);\n\t\t\tcurrent !== undefined;\n\t\t\tcurrent = this.entries.ceil(pos)\n\t\t) {\n\t\t\t// If there happened to be an attribution change at exactly pos, it's already set in the base entry\n\t\t\tif (current.key !== pos) {\n\t\t\t\tsplitCollection.entries.put(current.key - pos, current.data);\n\t\t\t}\n\t\t\tthis.entries.remove(current.key);\n\t\t}\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: TreeAttributionCollection): void {\n\t\tconst lastEntry = this.getAtOffset(this.length - 1);\n\t\tother.entries.map(({ key, data }) => {\n\t\t\tif (key !== 0 || !areEqualAttributionKeys(lastEntry, data)) {\n\t\t\t\tthis.entries.put(key + this.length, data);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\tconst results: { offset: number; key: AttributionKey | null }[] = [];\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tresults.push({ offset: key, key: data });\n\t\t\treturn true;\n\t\t});\n\t\treturn { root: results, length: this.length };\n\t}\n\n\tpublic clone(): TreeAttributionCollection {\n\t\tconst copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tcopy.entries.put(key, data);\n\t\t\treturn true;\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { seqs, posBreakpoints } = summary;\n\t\tassert(\n\t\t\tseqs.length === posBreakpoints.length && seqs.length > 0,\n\t\t\t\"Invalid attribution summary blob provided\",\n\t\t);\n\t\tlet curIndex = 0;\n\t\tlet cumulativeSegPos = 0;\n\t\tlet currentInfo = seqs[curIndex];\n\t\tconst getCurrentKey = () =>\n\t\t\ttypeof currentInfo === \"object\"\n\t\t\t\t? currentInfo\n\t\t\t\t: ({ type: \"op\", seq: currentInfo } as const);\n\n\t\tfor (const segment of segments) {\n\t\t\tconst attribution = new TreeAttributionCollection(\n\t\t\t\tsegment.cachedLength,\n\t\t\t\tgetCurrentKey(),\n\t\t\t);\n\t\t\twhile (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\tcurrentInfo = seqs[curIndex];\n\t\t\t\tattribution.entries.put(\n\t\t\t\t\tposBreakpoints[curIndex] - cumulativeSegPos,\n\t\t\t\t\tgetCurrentKey(),\n\t\t\t\t);\n\t\t\t\tcurIndex++;\n\t\t\t}\n\n\t\t\tsegment.attribution = attribution;\n\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t}\n\t}\n\n\tpublic update(): void {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst posBreakpoints: number[] = [];\n\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\tlet cumulativePos = 0;\n\n\t\tlet segmentsWithAttribution = 0;\n\t\tlet segmentsWithoutAttribution = 0;\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.attribution) {\n\t\t\t\tsegmentsWithAttribution++;\n\t\t\t\tfor (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(info, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\tseqs.push(!info ? null : info.type === \"op\" ? info.seq : info);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = info;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentsWithoutAttribution++;\n\t\t\t}\n\n\t\t\tcumulativePos += segment.cachedLength;\n\t\t}\n\n\t\tassert(\n\t\t\tsegmentsWithAttribution === 0 || segmentsWithoutAttribution === 0,\n\t\t\t\"Expected either all segments or no segments to have attribution information.\",\n\t\t);\n\n\t\tconst blobContents: SerializedAttributionCollection = {\n\t\t\tseqs,\n\t\t\tposBreakpoints,\n\t\t\tlength: cumulativePos,\n\t\t};\n\t\treturn blobContents;\n\t}\n}\n\ndescribe(\"IAttributionCollection perf\", () => {\n\tdescribe(\"tree implementation\", () => {\n\t\trunAttributionCollectionSuite(TreeAttributionCollection, BenchmarkType.Diagnostic);\n\t});\n\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributionCollection.spec.d.ts","sourceRoot":"","sources":["../../src/test/attributionCollection.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|