Skip to content

Improve performance by wiring bulk metadata map into refresh path#81

Merged
AlanRockefeller merged 2 commits intomainfrom
perf/bulk-metadata-refresh
Apr 16, 2026
Merged

Improve performance by wiring bulk metadata map into refresh path#81
AlanRockefeller merged 2 commits intomainfrom
perf/bulk-metadata-refresh

Conversation

@AlanRockefeller
Copy link
Copy Markdown
Owner

@AlanRockefeller AlanRockefeller commented Apr 16, 2026

Summary by CodeRabbit

  • Refactor

    • Optimized metadata handling so thumbnail refreshes fetch metadata only for the images currently shown, improving responsiveness during filtering, sorting, and view refreshes.
    • Streamlined bulk metadata processing to reduce unnecessary work when updating large image collections.
  • New Features

    • Thumbnail refresh now supports on-demand metadata lookup for filtered subsets, reducing delays and IO during common operations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1d896cd-369d-4200-8b56-9764b38c0684

📥 Commits

Reviewing files that changed from the base of the PR and between 3133ac2 and 10d8ee4.

📒 Files selected for processing (2)
  • faststack/app.py
  • faststack/thumbnail_view/model.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • faststack/app.py

Walkthrough

AppController now passes a metadata_map_fn callback into ThumbnailModel.refresh_from_controller(...) instead of only image lists; _get_bulk_metadata_map was changed to accept an optional images argument so metadata can be produced for a scoped subset (defaults to all images).

Changes

Cohort / File(s) Summary
Controller call sites
faststack/app.py
Replaced direct image-list-only calls to ThumbnailModel.refresh_from_controller(...) with calls that pass a metadata_map_fn (now using self._get_bulk_metadata_map). Updated initial load, filter apply/clear, sort-mode changes, full refresh, and grid-view activation call sites.
Thumbnail model behavior
faststack/thumbnail_view/model.py
ThumbnailModel.refresh_from_controller gained an optional metadata_map_fn parameter. When provided and no metadata_map is given, the model calls metadata_map_fn(images_after_filter) to lazily build metadata only for the filename-filtered subset; flag-filtering still uses metadata_map (or falls back to per-item _get_metadata).

Sequence Diagram(s)

sequenceDiagram
  participant UI as "UI / User"
  participant App as "AppController"
  participant Model as "ThumbnailModel"
  participant Meta as "Metadata provider\n(_get_bulk_metadata_map)"

  UI->>App: trigger load/filter/sort/grid-change
  App->>Model: refresh_from_controller(images, metadata_map_fn=Meta)
  Model->>Model: apply filename filter -> filtered_images
  alt metadata_map not provided
    Model->>Meta: metadata_map_fn(filtered_images)
    Meta-->>Model: metadata_map (subset)
  end
  Model->>Model: apply flag-filtering using metadata_map or per-item metadata
  Model->>Model: bulk_add thumbnails with metadata_map
  Model-->>App: refresh complete / update view
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: wiring bulk metadata map callbacks into the refresh path to improve performance by fetching metadata only for filtered images.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/bulk-metadata-refresh

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3133ac2e62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread faststack/app.py Outdated
Comment on lines +639 to +640
self.image_files,
metadata_map=self._get_bulk_metadata_map(self.image_files),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Build metadata map after filename filtering

Passing self.image_files into _get_bulk_metadata_map(...) forces a sidecar metadata lookup for every image on each grid refresh, even when an active filename filter would shrink the list dramatically. In ThumbnailModel.refresh_from_controller, filename filtering happens inside the model before metadata is needed, so this change turns filtered refreshes (e.g., typing in search) from roughly O(k) metadata reads to O(N), which can noticeably regress UI responsiveness in large folders.

Useful? React with 👍 / 👎.

…_from_controller invoke it after filename filtering
@AlanRockefeller AlanRockefeller merged commit ef2a6fc into main Apr 16, 2026
3 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 17, 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.

1 participant