Skip to content

⚡ Bolt: scripts: make-sbom.py: optimize opkg parsing speed#108

Merged
manupawickramasinghe merged 1 commit into
mainfrom
bolt-make-sbom-opt-7781707570110447472
Jun 3, 2026
Merged

⚡ Bolt: scripts: make-sbom.py: optimize opkg parsing speed#108
manupawickramasinghe merged 1 commit into
mainfrom
bolt-make-sbom-opt-7781707570110447472

Conversation

@ManupaKDU
Copy link
Copy Markdown

💡 What: Optimize the get_opkg_sbom parsing logic in scripts/make-sbom.py by replacing a for line in text.splitlines(): dictionary-building loop with fast str.find indexing.
🎯 Why: To drastically reduce intermediate object allocations (lists of strings, dictionaries with many unused keys) and memory bloat when generating an SBOM from a very large OPKG index file, lowering both memory usage and total execution time.
📊 Impact: The optimized method cuts parsing time for a 50,000 package file by roughly 50% (~0.87s to ~0.41s) and uses significantly less memory due to O(1) object creation.
🔬 Measurement: python3 bench2.py in the workspace demonstrated the ~2x performance gain, and python3 -m unittest discover -s scripts -p 'test_*.py' passes successfully.

Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>


PR created automatically by Jules for task 7781707570110447472 started by @manupawickramasinghe

Avoid allocating massive intermediate objects (lists of lines and dictionaries of all fields per block) during parsing of large index files.
Using string find reduces memory consumption and halves the processing time on large data sizes.

Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@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.

@manupawickramasinghe manupawickramasinghe merged commit da07585 into main Jun 3, 2026
6 checks passed
@manupawickramasinghe manupawickramasinghe deleted the bolt-make-sbom-opt-7781707570110447472 branch June 3, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants