Skip to content

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
mainfrom
claude/project-thread-c0eely
Open

t0mdavid-m wants to merge 5 commits into
mainfrom
claude/project-thread-c0eely

Conversation

@t0mdavid-m

@t0mdavid-m t0mdavid-m commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

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:

  1. Remove mygene. It pulls in biothings_client, but nothing in the app uses it.
  2. Import plotly.express inside WorkflowTest.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:

Library Cost (19 and 21 Nov)
mygene 130 ms
plotly.express 209 ms

Measured with the coldstart.py server profile, before and after each change:

Change src.WorkflowTest import, before After
Remove mygene 147 ms 117 ms
Import plotly.express where used (on top of main) 154 ms 74 ms

The total time spent importing modules while pages ran also dropped, from 1.0 s to 830 ms.

Tests

  • tests/test_workflow_import_cost.py now asserts that neither mygene nor plotly.express is in sys.modules after import src.WorkflowTest. The new cases fail before these changes and pass after them.
  • test_gui.py passes.

The mygene line in requirements.txt stays in place, so the installed packages do not change.

Screenshot

Describe experiment, with both changes applied:

Describe experiment

🤖 Generated with Claude Code

https://claude.ai/code/session_01FkEGeoxU48Hp4NVJaXNGfh

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
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c3c902d-e134-4cf5-92a9-af4b0200a793
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@t0mdavid-m t0mdavid-m self-assigned this Nov 19, 2026
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
@t0mdavid-m t0mdavid-m changed the title Faster first load of the workflow pages: drop an unused import Faster first load of the workflow pages: drop an unused import, import plotly express where used Nov 21, 2026
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.

2 participants