Closed wangyuqing0424 closed 9 months ago
@wangyuqing0424 Thanks! Would the pre-intersection test work faster if you cache target variables as many as possible instead of computing them ad-hoc each time? Please also briefly mention the idea by editing the comment above so people know what we're hacking here :)
The attempt to optimize runtime speed through caching target variables has not yielded significant improvements, as the computation of target variables does not take much processing time
test_combined
, we were able to reduce the number of cells from 78 to 62, resulting in a runtime improvement from 1.40s to 1.38s.
In the test_complex
, we were able to reduce the number of cells from 789 to 737, resulting in a runtime improvement from 19.18s to 17.60s.Tested working on the complex test_church.obj
data. Stats below recorded with AMD EPYC 7542 a single core:
Before PR:
.../test_complex.py
INFO primitive.py:617 processing .../abspy/tests/test_data/test_church.obj
INFO complex.py:444 constructing cell complex
100%|██████████| 218/218 [01:12<00:00, 3.02it/s]
INFO complex.py:537 cell complex constructed: 72.22 s
INFO complex.py:831 number of planes: 218
INFO complex.py:832 number of cells: 3408
After PR:
.../test_complex.py
INFO primitive.py:632 processing .../abspy/tests/test_data/test_church.obj
INFO complex.py:609 constructing cell complex
100%|██████████| 218/218 [01:01<00:00, 3.55it/s]
INFO complex.py:705 cell complex constructed: 61.43 s
INFO complex.py:999 number of planes: 218
INFO complex.py:1000 number of cells: 2735
This PR adds an additional set of intersection tests between primitive and cells using SAT, on top of the existing AABB test. The intersection tests reduce the runtime and the number of resulting cells.