[CAM] Fix ramp dressup performance (#21944)

* [CAM] fix biggest performance problems in ramp dressup

key items:

- finding the index of the current edge with edeges.index(edge) was very
  expensive; fixed by tracking the index while looping

- checking which edges were rapids with edge equality was also
  expensive; fixed by keeping a list of indexes of rapid input edges,
and tagging output edges with whether or not they are rapids

* [CAM] comment out Path.Log.debug in hot segments of ramping code

Even when low level logs are supposed to be suppressed, Path.Log.debug
takes take invoking traceback.extract_stack. This time adds up if logs
are invoked in frequently run loops.

* Fix CAM test

* [CAM] reimplment ramp method 1 with faster code

* [CAM] reimplement ramp methods 2, 3, and helix

* [CAM] patch to make output match original

* [CAM] ramping full performance + functionality fix
This commit is contained in:
David Kaufman
2025-09-02 11:32:03 -04:00
committed by GitHub
parent 540ce39cb1
commit f156e467c9
5 changed files with 397 additions and 498 deletions

View File

@@ -557,7 +557,7 @@ class TestPathGeom(PathTestBase):
commands.append(Path.Command("G0", {"X": 0}))
commands.append(Path.Command("G1", {"Y": 0}))
wire, rapid = Path.Geom.wireForPath(Path.Path(commands))
wire, rapid, rapid_indexes = Path.Geom.wireForPath(Path.Path(commands))
self.assertEqual(len(wire.Edges), 4)
self.assertLine(wire.Edges[0], Vector(0, 0, 0), Vector(1, 0, 0))
self.assertLine(wire.Edges[1], Vector(1, 0, 0), Vector(1, 1, 0))