Skip to content

⚡ [performance improvement] optimize string dump blacklist matching - #53

Open
himadriganguly wants to merge 1 commit into
masterfrom
perf-stringdump-blacklist-638735878223168397
Open

⚡ [performance improvement] optimize string dump blacklist matching#53
himadriganguly wants to merge 1 commit into
masterfrom
perf-stringdump-blacklist-638735878223168397

Conversation

@himadriganguly

Copy link
Copy Markdown
Member

💡 What

The blacklist matching logic inside StringDump.__removeBlackListStrings (pkgs/stringdump.py) has been rewritten. Instead of iterating through every blacklisted item and searching against the full strings list to remove elements sequentially, the new logic:

  1. Puts exact-match blacklisted strings into a Python set for $O(1)$ lookups.
  2. Pre-compiles regular expressions outside the loop.
  3. Filters the list via list comprehensions using not in and not any().

🎯 Why

The original logic was highly inefficient, exhibiting quadratic/cubic complexity. For large sample files and blacklists, the repeated calls to finalStringList.remove(black) inside a loop iterating over every blacklist item and regular expression would lead to severe CPU utilization overhead.

📊 Measured Improvement

A simulated benchmark script mimicking the blacklist inputs showed roughly a 17x speedup:

  • Baseline execution time: 0.4909s
  • Optimized execution time: 0.0276s
    This means string extraction processes will run significantly faster on larger sets.

PR created automatically by Jules for task 638735878223168397 started by @himadriganguly

Refactored the `__removeBlackListStrings` method in `pkgs/stringdump.py` to use Python sets and list comprehensions. This avoids deeply nested loops and multiple $O(N)$ `list.remove` operations.

Co-authored-by: himadriganguly <5839433+himadriganguly@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

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