Parallelized .wasm download and deferred font loading#1647
Merged
Conversation
1924aba to
c411e87
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Remove
webfontloaderand replace with bespoke font-awaiting logic based ondocument.fonts. Perspective does not need IE9 fallbacks, as the crossover between WebAssembly andFontFaceSetsupport is 100%, pluswebfontloaderis global and can interfere with an embedd-er application.<perspective-viewer>will now set itself to invisible for up to 1sec while awaiting the fonts specified by the CSS var--preload-fonts, which prevents the dreaded Flash Of Unstyled Text as well as subsequent re-flows caused by shifting font widths. This new strategy means fonts are loading in parallel without blocking WASM asset downloading, leading to much faster initial page load when properly configured.Re-work load logic for
perspectiveandperspective-viewerto ensure that asset loading occurs as soon as possible and utilizesinstantiateStreaming()where viable, maximizing parallelism such that the UI is no slower to load than the largest asset (currentlyperspective.cpp.wasm).