Skip to content

⚡ Cache primability and stability scores in search results#104

Draft
google-labs-jules[bot] wants to merge 1 commit intostablefrom
perf-cache-scores-repliconf-7479601605716977255
Draft

⚡ Cache primability and stability scores in search results#104
google-labs-jules[bot] wants to merge 1 commit intostablefrom
perf-cache-scores-repliconf-7479601605716977255

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

Cached primability and stability scores in DirIdx to optimize ReplicationOrigin instantiation.

Modified:

  • src/amplifyp/origin.py: Updated ReplicationOrigin to accept and use cached scores.
  • src/amplifyp/repliconf.py: Updated DirIdx to store scores and Repliconf to populate and pass them.

Verified with performance benchmark showing significant speedup in accessing search results. Passed all existing tests.


PR created automatically by Jules for task 7479601605716977255 started by @fangfufu

This change optimizes the retrieval of `ReplicationOrigin` objects by caching the `primability` and `stability` scores computed during the search phase.

Key changes:
- `DirIdx`: Added `primability` and `stability` fields to store cached scores. Updated `__hash__` to rely only on `direction` and `index` to preserve identity semantics.
- `Repliconf.search`: Populated `DirIdx` with calculated scores when a match is found.
- `Repliconf.origin`: Passed cached scores from `DirIdx` to `ReplicationOrigin`.
- `ReplicationOrigin`: Added `_cached_primability` and `_cached_stability` fields and updated property accessors to use these cached values if available.

Performance improvement: Access time for 63k origins reduced from ~4.13s to ~0.25s (~16x speedup). Total search + access time reduced from ~4.76s to ~1.01s.
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 26, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (stable@aac150a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/amplifyp/repliconf.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             stable     #104   +/-   ##
=========================================
  Coverage          ?   92.53%           
=========================================
  Files             ?        9           
  Lines             ?      750           
  Branches          ?        0           
=========================================
  Hits              ?      694           
  Misses            ?       56           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fangfufu fangfufu force-pushed the master branch 2 times, most recently from 47a5ea6 to f204e89 Compare January 27, 2026 22:08
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.

0 participants