Repository navigation
Faster first load of the workflow pages: drop an unused import, import plotly express where used - #172
Open
t0mdavid-m wants to merge 5 commits into
Open
Faster first load of the workflow pages: drop an unused import, import plotly express where used#172t0mdavid-m wants to merge 5 commits into
t0mdavid-m wants to merge 5 commits into
Conversation
Every workflow page imports src.WorkflowTest, so mygene (and biothings_client behind it) was loaded on each first page load although nothing in the app uses it. The import-cost test now also asserts mygene stays unloaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Only results() draws plotly express figures, so importing it at module level made every workflow page pay for it on its first load. The import-cost test now also asserts plotly.express stays unloaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh
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.
Requested by Tom · project thread
What it does
Every workflow page (Describe experiment, Run analysis and parts of Explore results) imports
src/WorkflowTest.py, so whatever that module imports at the top is paid for on the first load of each page. This PR makes two changes to those imports:mygene. It pulls inbiothings_client, but nothing in the app uses it.plotly.expressinsideWorkflowTest.results(). That method is the only place that draws plotly express figures.Measurements
Measured with the daily first-load check after a restart, on a cold disk:
mygeneplotly.expressMeasured with the
coldstart.pyserver profile, before and after each change:src.WorkflowTestimport, beforemygeneplotly.expresswhere used (on top of main)The total time spent importing modules while pages ran also dropped, from 1.0 s to 830 ms.
Tests
tests/test_workflow_import_cost.pynow asserts that neithermygenenorplotly.expressis insys.modulesafterimport src.WorkflowTest. The new cases fail before these changes and pass after them.test_gui.pypasses.The
mygeneline inrequirements.txtstays in place, so the installed packages do not change.Screenshot
Describe experiment, with both changes applied:
🤖 Generated with Claude Code
https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh