Skip to content

Faster comparison view online: read each stored table once per click - #307

Merged
t0mdavid-m merged 3 commits into
developfrom
claude/project-thread-vjl338
Nov 20, 2026
Merged

t0mdavid-m merged 3 commits into
developfrom
claude/project-thread-vjl338

Conversation

@t0mdavid-m

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

Copy link
Copy Markdown
Member

What it does

In the online FLASHApp, comparing runs is slow. Each click (selecting a proteoform, sorting a table, switching the view) takes about 11 s, and opening the page takes about 16 s. On a local disk, the same release handles a click in 0.5 s.

The visualizations account for almost none of that time. A click sends about 90 KB, and the server spends about 0.3 s of CPU on the rerun. The rest is spent waiting on storage. The comparison view creates one QuantSession per rerun, and every component on the page asks it again for the design, the settings, the stamps and the analysed tables. Each request reads the workspace cache (an sqlite query plus a file), which comes to about 140 result reads, 150 existence checks and 490 index queries per click. The online deployment keeps workspaces on network storage, so each read is a round trip of a few milliseconds, and the reads run one after another.

With this change, the session keeps what it has read until the rerun ends, and forgets it whenever it writes. It hands out copies, so a caller that changes a dict cannot change what the next component gets. Every Streamlit rerun creates a new session, so nothing is kept from one click to the next.

Measured

These numbers are from the example label-free comparison run locally, with every workspace read delayed by 25 ms to imitate network storage. The browser script is the same one the daily latency check uses (median of 2 runs):

before after
load 27.0 s 8.2 s
select a proteoform 26.9 s 7.8 s
sort 27.1 s 7.9 s
result reads per click 142 19
existence checks per click 146 17
index queries per click 493 118

Most of the remaining index queries come from FileManager, which asks sqlite for its column list on every read. Caching that list would be the next step.

Screenshots and video

These were recorded with 10 ms per read. Each video loads Explore results and then selects a proteoform.

Before: https://github.com/OpenMS/FLASHApp/raw/3b984fd972d594a22c45cc4099a2790818f506ae/pr-media/select-before.mp4

After: https://github.com/OpenMS/FLASHApp/raw/3b984fd972d594a22c45cc4099a2790818f506ae/pr-media/select-after.mp4

The views look the same before and after the change.

before after
before after

After, in the dark theme:
after dark

The media were committed and then removed in the next commit, so the diff contains only src/quant/session.py and its test.

Checked

  • The new test test_session_reads_each_stored_table_once fails without the change and passes with it. It also checks that a returned value cannot be changed from outside and that set_hidden still takes effect.
  • pytest tests/: 1518 passed, 5 skipped. pylint --errors-only reports nothing on the changed files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU

The comparison view makes one QuantSession per rerun, and every component
asks it for the design, settings, stamps and analysed tables again. Each
ask went to the workspace cache (sqlite index plus a file), about 140
reads per click. On the online deployment, where the workspace sits on
network storage, those serial round trips made a click take about 11 s.
The session now keeps what it read for the rest of the rerun and forgets
it whenever it writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

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: 49eb5081-318d-42c4-b42f-00d158768617
  • 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 merged commit d97d43d into develop Nov 20, 2026
18 checks passed
@t0mdavid-m
t0mdavid-m deleted the claude/project-thread-vjl338 branch November 20, 2026 18:57
t0mdavid-m added a commit that referenced this pull request Nov 20, 2026
* Release 2.0.0-alpha.13

Bump the version and installer name and list the faster comparison view
(#307) on the Quickstart page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU

* PR media: What's new panel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU

* Remove PR media

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGeoUM7eM3f7WXck24oU

---------

Co-authored-by: Claude <noreply@anthropic.com>
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