Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

⚡ Optimize check_drift.py: Use any() and tuple prefix matching#38

Open
HeadyConnection wants to merge 1 commit intomainfrom
perf/optimize-check-drift-8613324875979557582
Open

⚡ Optimize check_drift.py: Use any() and tuple prefix matching#38
HeadyConnection wants to merge 1 commit intomainfrom
perf/optimize-check-drift-8613324875979557582

Conversation

@HeadyConnection
Copy link
Copy Markdown
Contributor

💡 What:

  • Replaced inefficient string concatenation " ".join(changed) with any() generator for documentation drift check.
  • Optimized watched_changes filtering to use str.startswith(tuple) instead of nested loops.

🎯 Why:

  • The original code concatenated all file paths into a single string to check for "docs/" presence, which is memory inefficient and slower for large diffs.
  • The watched_changes logic was iterating through prefixes for every file path in python loop.
  • These changes significantly improve performance and memory usage.

📊 Measured Improvement:
Benchmark with 100,000 file paths (shuffled):

  • Baseline: 3.13s
  • Optimized: 0.51s
  • Speedup: ~6.1x

PR created automatically by Jules for task 8613324875979557582 started by @HeadyConnection

Co-authored-by: HeadyConnection <250789142+HeadyConnection@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant