Conversation
Optimized `DocxXMLEditor._get_next_change_id` to cache the next available change ID instead of scanning the full DOM every time. - Reduces complexity from O(N*M) to O(M+N) for N insertions in a document of size M. - Measured 20x speedup (4.06s -> 0.20s) for inserting 50 tracked changes in a 20k paragraph document. - Ensures ID uniqueness while avoiding redundant traversals. Co-authored-by: timteh <211128536+timteh@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
⚡ Bolt: Optimize DocxXMLEditor ID generation
💡 What
Modified
skills/docx/scripts/document.pyto cache the next available tracked change ID inDocxXMLEditor.🎯 Why
The previous implementation scanned the entire DOM (using
getElementsByTagName) every time a new tracked change (insertion or deletion) was added to find the maximum existing ID. This caused performance to degrade linearly with document size and the number of insertions ($O(N \cdot M)$).📊 Impact
🔬 Measurement
Created a reproduction script
repro_perf.pythat generates a large XML document and inserts tracked changes.PR created automatically by Jules for task 2205038832139254445 started by @timteh