Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sfc-gh-tteixeira
Copy link
Contributor

Describe your changes

Today, when running streamlit hello in a fresh venv the first loads quickly (yay!) but then subpages like the "Dataframe demo" are super slow. Here's what it looks like:

before.mov

This slowness is due to the import pandas, which in a fresh venv requires a slow compilation step.

This PR makes up for this by adding import pandas to the bottom of the first page of streamlit hello, after all important content has loaded. My feeling is that this makes everything feel faster. See for yourself:

after.mov

GitHub Issue Link (if applicable)

n/a

Testing Plan

  • Explanation of why no additional tests are needed: this just adds some no-op imports to a file. I'm not even sure how we'd test this if we wanted to...
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Sep 24, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12617/streamlit-1.50.0-py3-none-any.whl
🕹️ Preview app pr-12617.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-jrieke
Copy link
Contributor

SGTM!

Copy link
Contributor

@sfc-gh-nbellante sfc-gh-nbellante left a comment

Choose a reason for hiding this comment

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

Love this idea. Approving as is, and proactively approving the thread approach we discussed. (If you want me to take another look at it after that commit let me know!)

@sfc-gh-tteixeira sfc-gh-tteixeira added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Sep 24, 2025
@sfc-gh-tteixeira
Copy link
Contributor Author

FYI: I tried loading pandas in a thread, and this still showed the "running person" animation in the top right, so I think it's best to just keep the implementation in this PR as-is.

@sfc-gh-tteixeira sfc-gh-tteixeira merged commit a430384 into develop Sep 24, 2025
42 of 43 checks passed
@sfc-gh-tteixeira sfc-gh-tteixeira deleted the hello-preload branch September 24, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants