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

MWPW-157573 Optimize EdgeWorker for Mobile Widget #785

Merged
merged 7 commits into from
Sep 12, 2024
Merged

Conversation

TsayAdobe
Copy link
Collaborator

@TsayAdobe TsayAdobe commented Sep 5, 2024

  • Enable different caches for desktop, tablet, and mobile devices.
  • If the metadata mobile-widget is true and the client device type is mobile, the DC converter widget is not required. Eliminate unnecessary preloads and embedded scripts.
  • The change has been deployed to the stage environment.

Resolve: MWPW-157573

Test URLs:
https://www.stage.adobe.com/acrobat/online/sign-pdf.html
https://www.stage.adobe.com/acrobat/online/pdf-editor.html

Copy link

aem-code-sync bot commented Sep 5, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.18%. Comparing base (59f7ed8) to head (c502e91).
Report is 10 commits behind head on stage.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage     #785      +/-   ##
==========================================
+ Coverage   90.15%   90.18%   +0.03%     
==========================================
  Files          43       43              
  Lines        5494     5512      +18     
==========================================
+ Hits         4953     4971      +18     
  Misses        541      541              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const [responseStream, responseHeaders, dcCoreVersion, mobileWidget] = await fetchFrictionlessPageAndInlineSnippet();

await Promise.all([
fetchAndInlineScripts(mobileWidget),
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like this will hurt our performance. There are fetches in there that would otherwise be done in parallel with the first request

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need to know if mobile-widget is true or false to decide what scripts to be inline and preloads. Therefore, they have to be separated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

scripts.js is loaded regardless.

loading dc-conversion-widget.js conditionally, blocked by the first Promise, will hurt Frictionless performance on production where it is used. It might be better to load it, in parallel, and not use it where you don't need it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps we could break fetchAndInlineScripts into two separate methods - fetchScript and inlineScripts. Then we could still fetch the frictionlesspage and fetchscripts in parallel, and then call inlineScripts(mobileWidget)

Copy link
Collaborator

@peller peller left a comment

Choose a reason for hiding this comment

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

need to make fetch requests in parallel where possible

@peller
Copy link
Collaborator

peller commented Sep 7, 2024

Also, if we add a conditional to generate a different result for the same url, we can no longer cache it. That would be a huge performance loss.

@TsayAdobe
Copy link
Collaborator Author

Also, if we add a conditional to generate a different result for the same url, we can no longer cache it. That would be a huge performance loss.

onClientRequest adds device type to the cache key. Mobile, tablet, and desktop have different caches.

@Blainegunn Blainegunn merged commit 76ebf4f into stage Sep 12, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants