Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(tree): avoid cloning change enricher checkout on every change #21056

Merged
merged 22 commits into from
May 23, 2024

Conversation

yann-achard-MS
Copy link
Contributor

@yann-achard-MS yann-achard-MS commented May 11, 2024

Description

Before this PR, commits were enriched between their application to the local checkout and their sending to the service.
This required keeping a defensive clone of the enricher checkout so that it could enrich a commit based on the state immediately before that commit was applied.

This PR change the old order of operations (apply-enrich-submit) to enrich-apply-submit. This allows the enrichment to be performed based on the forest and detached field index of the top-level checkout instead of a clone, thus making cloning necessary only in resubmit scenarios.

While the above sounds simple, it prompted a lot of changes to accommodate the intricacies of transactions.
A subsequent PR (perhaps after GA if it is deemed to destabilizing) could clean up a lot of this complexity by making transactions less special throughout the system.

Breaking Changes

None

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels May 11, 2024
@yann-achard-MS yann-achard-MS marked this pull request as ready for review May 11, 2024 01:28
@yann-achard-MS yann-achard-MS requested a review from a team as a code owner May 11, 2024 01:28
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented May 13, 2024

@fluid-example/bundle-size-tests: +4.16 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 453.27 KB 453.27 KB No change
azureClient.js 552.46 KB 552.46 KB No change
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 256.95 KB 256.95 KB No change
fluidFramework.js 357.8 KB 359.88 KB +2.08 KB
loader.js 134.34 KB 134.34 KB No change
map.js 41.53 KB 41.53 KB No change
matrix.js 143.75 KB 143.75 KB No change
odspClient.js 520.83 KB 520.83 KB No change
odspDriver.js 97.3 KB 97.3 KB No change
odspPrefetchSnapshot.js 42.16 KB 42.16 KB No change
sharedString.js 160.27 KB 160.27 KB No change
sharedTree.js 357.78 KB 359.86 KB +2.08 KB
Total Size 3.19 MB 3.2 MB +4.16 KB

Baseline commit: acd3407

Generated by 🚫 dangerJS against d6d9168

private readonly enricher: ChangeEnricherReadonlyCheckout<TChange>;
/**
* Maps each local commit to the corresponding enriched commit.
* Entries are added then the commits are prepared (before being applied and submitted).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Entries are added then the commits are prepared (before being applied and submitted).
* Entries are added when the commits are prepared (before being applied and submitted).

* This is similar to a {@link TreeCheckout} in that it represents the state of the tree at a specific revision.
* But unlike a `TreeCheckout`...
* - It is not backed by a branch because the `CommitEnricher` that owns it controls which revision it should represent.
* - The host application has no knowledge of it, so applying changes to it has not impact on the application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* - The host application has no knowledge of it, so applying changes to it has not impact on the application.
* - The host application has no knowledge of it, so applying changes to it has no impact on the application.

@yann-achard-MS yann-achard-MS enabled auto-merge (squash) May 23, 2024 00:57
@yann-achard-MS yann-achard-MS merged commit 25a6971 into microsoft:main May 23, 2024
30 checks passed
@yann-achard-MS yann-achard-MS deleted the encode-before-apply branch May 23, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants