feat: performance optimizations + part-materials validation

- @timed_step decorator with wall-clock + RSS tracking (pipeline_logger)
- Blender timing laps for sharp edges and material assignment
- MeshRegistry pattern: eliminate 13 scene.traverse() calls across viewers
- Lazy material cloning (clone-on-first-write in both viewers)
- _pipeline_session context manager: 7 create_engine() → 2 in render_thumbnail
- KD-tree spatial pre-filter for sharp edge marking (bbox-based pruning)
- Batch material library append: N bpy.ops.wm.append → single bpy.data.libraries.load
- GMSH single-session batching: compound all solids into one tessellation call
- Validate part-materials save endpoints against parsed_objects (prevents bogus keys)
- ROADMAP updated with completion status

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 11:53:14 +01:00
parent ec667dd56a
commit 6c5873d51f
11 changed files with 612 additions and 541 deletions
+10 -5
View File
@@ -24,6 +24,9 @@
| Render job tracking | `RenderJobDocument`, `PipelineLogger`, and cancel-via-real-`celery_task_id` are already wired into the render pipeline |
| Tenant isolation baseline | `TenantContextMiddleware`, JWT `tenant_id`, and the `global_admin` / `tenant_admin` role hierarchy are in place for HTTP requests |
| Hash groundwork | `compute_step_hash()` exists and `CadFile.step_file_hash` is already persisted during thumbnail processing |
| Performance profiling | `@timed_step` decorator, Blender timing laps, MeshRegistry (17→8 traverse calls eliminated), `_pipeline_session` context manager, KD-tree spatial pre-filter for sharp edges, batch material library append, GMSH single-session batching |
| Part-materials validation | `PUT /cad/{id}/part-materials` and `PUT /cad/{id}/manual-material-overrides` now reject unknown part names against `parsed_objects` |
| Dead code cleanup | Verified: `blender-renderer/`, `threejs-renderer/`, `flamenco/`, `renderproblems_tmp/` all deleted; STL endpoints/settings removed; no Pillow imports; docker-compose clean |
---
@@ -424,16 +427,18 @@ Priority 10 remaining polish — independent
## What To Do Next
**All 10 original priorities are complete** as of 2026-03-13.
**All 10 original priorities are complete.** Additionally completed as of 2026-03-13:
- **Performance profiling and optimization** — 12-task plan fully implemented (see `plan.md`)
- **Part-materials input validation** — prevents bogus keys from being persisted
- **Dead code cleanup** — verified all legacy directories, endpoints, and imports are gone
The only deferred item is **P10 M5 — Kanban drag-to-reject** (drag order cards to a "Rejected" column with a reason field). This is tracked in `plan.md`.
**Potential future work (not yet planned):**
**Remaining future work (not yet planned):**
- Automated test suite (currently no tests)
- Performance profiling for large assemblies (100+ parts)
- Batch material assignment UI improvements
- Additional USD features (instancing, LOD)
- Production deployment hardening (health checks, monitoring)
- Draw call batching for 100+ part assemblies (deferred from performance plan — high risk, needs real test data)
- Merge dual STEP parse into single read (deferred — OCP/OCC.Core API compatibility concerns)
---