Skip to content

⚡ Bolt: Optimize 3MF manifest scanning and gcode header parsing - #129

Open
DLANSAMA wants to merge 1 commit into
mainfrom
bolt/optimize-3mf-estimate-parsing-9347944549747451147
Open

⚡ Bolt: Optimize 3MF manifest scanning and gcode header parsing#129
DLANSAMA wants to merge 1 commit into
mainfrom
bolt/optimize-3mf-estimate-parsing-9347944549747451147

Conversation

@DLANSAMA

Copy link
Copy Markdown
Owner

💡 What:

  1. Single-pass 3MF zip manifest scanning in read_3mf_estimate: normalizes path backslashes once per member name (n.replace("\\", "/")) and uses direct string equality and prefix/suffix checks instead of allocating list objects via repeated .split('/') calls.
  2. Early loop exit in _parse_gcode_header: breaks out of line iteration as soon as both seconds and grams values are extracted.

🎯 Why:
3MF estimate parsing was performing redundant list allocations and string replacements per zip entry, scanning the entry list multiple times. Header line parsing continued through remaining text even after finding both target fields.

📊 Impact:

  • ~77% reduction in 3MF archive manifest scanning time (4.37x speedup on archive entry evaluation).
  • Faster estimate extraction during slicing, job preparation, and UI preview steps.

🔬 Measurement:
Verified via micro-benchmark on 3MF archive manifests (timeit showed execution time drop from 1.14s to 0.26s over 20,000 iterations). All unit tests in tests/test_slicer_estimate.py pass.


PR created automatically by Jules for task 9347944549747451147 started by @DLANSAMA

- Optimize read_3mf_estimate manifest scanning into a single O(N) pass.
- Eliminate repeated split('/') list allocations on zip entry names.
- Add early loop break in _parse_gcode_header once estimates are found.
@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 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