perf: Parse SVG once in semantic_analyzer instead of 6+ times #30

Closed
opened 2026-06-10 05:46:09 +00:00 by Mark · 0 comments
Owner

Problem

semantic_analyzer.py — each public method independently parses the SVG from string. When pipeline calls multiple methods on same SVG, the same string is parsed repeatedly.

Proposed Fix

Parse once in annotate_svg and pass the parsed tree to internal methods.

Impact

2-4x faster for pipeline runs.

Files

  • src/svg_annotation/semantic_analyzer.py
## Problem `semantic_analyzer.py` — each public method independently parses the SVG from string. When pipeline calls multiple methods on same SVG, the same string is parsed repeatedly. ## Proposed Fix Parse once in `annotate_svg` and pass the parsed tree to internal methods. ## Impact 2-4x faster for pipeline runs. ## Files - `src/svg_annotation/semantic_analyzer.py`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#30
No description provided.