Skip to content

Parallelized .wasm download and deferred font loading#1647

Merged
texodus merged 4 commits intomasterfrom
custom-fonts
Dec 3, 2021
Merged

Parallelized .wasm download and deferred font loading#1647
texodus merged 4 commits intomasterfrom
custom-fonts

Conversation

@texodus
Copy link
Member

@texodus texodus commented Dec 2, 2021

  • Remove webfontloader and replace with bespoke font-awaiting logic based on document.fonts. Perspective does not need IE9 fallbacks, as the crossover between WebAssembly and FontFaceSet support is 100%, plus webfontloader is 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 perspective and perspective-viewer to ensure that asset loading occurs as soon as possible and utilizes instantiateStreaming() where viable, maximizing parallelism such that the UI is no slower to load than the largest asset (currently perspective.cpp.wasm).

    Screen Shot 2021-12-03 at 11 38 08 AM

@texodus texodus force-pushed the custom-fonts branch 2 times, most recently from 1924aba to c411e87 Compare December 2, 2021 21:37
@texodus texodus added the enhancement Feature requests or improvements label Dec 2, 2021
@texodus texodus merged commit 5c168fb into master Dec 3, 2021
@texodus texodus deleted the custom-fonts branch December 3, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature requests or improvements

Development

Successfully merging this pull request may close these issues.

1 participant