Skip to content

Performance improvements to docs #2730

Merged
aliabd merged 13 commits into
mainfrom
aliabd/docs-performance
Nov 28, 2022
Merged

Performance improvements to docs #2730
aliabd merged 13 commits into
mainfrom
aliabd/docs-performance

Conversation

@aliabd
Copy link
Copy Markdown
Contributor

@aliabd aliabd commented Nov 28, 2022

I made some performance improvements to the docs, especially on mobile. I know we've talked about moving the website to a better framework, and we should still do that, but we have to make fixes now as they are currently unusable.

  • Enabled text compression (on nginx)
  • For mobile on load gradio js when example window is clicked. (this means no embedded components on mobile, but much better performance)
  • Figured out a memory leak that was causing the page to climb to insane amounts of memory (>9GB). Was due to some terrible js I wrote for hiding footers from embedded components. Fixed now and page stays at ~350MB.
  • Fixed some annoying layout shifts
  • Made the page mobile responsive

Before changes:

Screen Shot 2022-11-25 at 5 10 56 PM

After:

Screen Shot 2022-11-27 at 10 05 09 PM

Try comparing between the website and dev server on mobile. Note that most of these changes will only apply to /docs/main/ until we release a new pip version and /docs gets updated.

Closes: #2717

@abidlabs
Copy link
Copy Markdown
Member

1 -> 91 🔥🔥🔥

Copy link
Copy Markdown
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

I'm not seeing the 91, i get ~60 after a few tries but ~1 -> ~60 is huge. There is also a noticeable improvement in performance even without using automated testing. The old version of the docs is frequently unusable, even on desktop for me and closing it takes many seconds + locks up my browser. On mobile the current docs are completely unusable.

Regardless of whether it is 60 or 90 we should ship this asap, huge improvement. Awesome work @aliabd!

@aliabd
Copy link
Copy Markdown
Contributor Author

aliabd commented Nov 28, 2022

Hmm that's weird @pngwn, are you sure that's for /docs/main on www.gradio-staging.com and testing for mobile? I just got 93. I did see high 80s a few times but never 60. Maybe it's a latency thing!

But yes, the number doesn't really matter.

@aliabd
Copy link
Copy Markdown
Contributor Author

aliabd commented Nov 28, 2022

Btw @pngwn do you know how we'd enable text compression on the gradio.js served from s3? like https://gradio.s3-us-west-2.amazonaws.com/3.11.0/gradio.js

I think we'll have to zip them before uploading to s3. but not sure if there's a better way?

@abidlabs
Copy link
Copy Markdown
Member

LGTM @aliabd! The staging website loads significantly faster for me on desktop as well.

The CircleCI test that is failing is because the Hub is down. Rerunning that should cause it to pass (although we should mark it flaky for future reference)

@aliabd
Copy link
Copy Markdown
Contributor Author

aliabd commented Nov 28, 2022

Will try to figure out gzipping the gradio.js s3 module on a separate PR

@aliabd aliabd merged commit 1946229 into main Nov 28, 2022
@aliabd aliabd deleted the aliabd/docs-performance branch November 28, 2022 19:23
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.

Docs are unusable on mobile

3 participants