-
Notifications
You must be signed in to change notification settings - Fork 532
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
Prefetch snapshot so as to avoid network call from critical path. #5968
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e73bb63
Prefetch snapshot to avoid it from critical path
jatgarg d5a2670
merge conflict
jatgarg 8591df5
add to export
jatgarg 7ee7cde
Pr sugg
jatgarg 13e5e41
Pr sugg
jatgarg fa5bb33
Pr sugg
jatgarg cb4ed95
Pr sugg
jatgarg ae3a8ba
Pr sugg
jatgarg 6d4120a
Pr sugg
jatgarg 2cd228d
Pr sugg
jatgarg a5b2a28
bundle size testr
jatgarg a94c097
bundle size test
jatgarg bb9eea5
Merge branch 'main' of https://github.com/microsoft/FluidFramework in…
jatgarg b44e4c4
add api report
jatgarg 9c1052b
remove spaces
jatgarg 024bfa7
Add support to test it with webpack fluid laoder
jatgarg 296c388
don't import odsp cache
jatgarg 2df4150
cache
jatgarg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
examples/utils/bundle-size-tests/src/odspPrefetchSnapshot.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*! | ||
* Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
import { prefetchLatestSnapshot } from "@fluidframework/odsp-driver"; | ||
|
||
export function apisToBundle() { | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
prefetchLatestSnapshot(undefined as any, undefined as any, undefined as any, undefined as any, undefined); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emails suggested that this produced 30kb bundle. Is this really the case? There is not much code in here.
It's worth taking a look on why it's so large. I assume numbers are for non-minimized code, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be minified code. I would recommend having someone take a look of the output of a plugin like this when we run just this api through webpack in production mode: https://github.com/webpack-contrib/webpack-bundle-analyzer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prefetchSnapshot api file seems to be about ~10Kb and then almost all utilities are used from odspUtils which also seems to account for ~10KB and then there are some other imports from driver-defn, assert, uuid etc which could have accounted for 10Kb more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heliocliu These are non-minimized bundle size, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metric is for minified code. The 30kb includes all its dependencies (and their dependencies, etc) as well. If a host were to take a dependency on this method without already having any dependencies on this method's dependencies, the host would incur a 30kb size increase. Like mentioned before, the tool doesn't seem to handle new metrics well, but the way it produces the numbers in the table is otherwise simple and the difference in the Total Size Size Diff value and the sum of individual Size Diff values gives the size of the newly added metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replied in the email with division of sizes. Just pasting here but we can continue discussion in email thread.