Previously algebra minus had a check that verified all arguments were
of same dimension. However OCCT supports cutting a shape with shapes
that are of equal OR larger dimension. This commit modifies the check
to support larger dimensions and adds tests for all dimension
variations.
A classic case of the win described by
https://build123d.readthedocs.io/en/latest/algebra_performance.html
Before, these test cases took 1.26s and 0.28s, making them the slowest
and 8th-slowest test cases in the entire repo according to `py.test
--durations=10`, and a full pytest run takes 12.31s.
After, these test cases both take 0.09s, and a full run takes 10.90s.
Also added `prof/` to `.gitignore` because using pytest's
`--profile{-svg}` options creates this directory but it is unlikely to
be usefully tracked by git.
Before: `644 passed in 19.89s`.
After: `644 passed in 12.47s`.
Running with `python -m pytest --durations=5` showed this test case
was a huge outlier, and timing its execution showed a huge disparity
between the time `TechnicalDrawing` thought it took to run and the
time its caller saw et up. Dropping the Builder context makes these
times lineup.
Tested the individual test case speed-up with `hyperfine -- 'python -m pytest tests/test_drafting.py::TestTechnicalDrawing::test_basic_drawing'`
which reports before & after of:
```
Benchmark 1: python -m pytest tests/test_drafting.py::TestTechnicalDrawing::test_basic_drawing
Time (mean ± σ): 9.488 s ± 0.534 s [User: 9.525 s, System: 1.478 s]
Range (min … max): 9.117 s … 10.929 s 10 runs
Benchmark 1: python -m pytest tests/test_drafting.py::TestTechnicalDrawing::test_basic_drawing
Time (mean ± σ): 1.951 s ± 0.040 s [User: 2.292 s, System: 1.111 s]
Range (min … max): 1.871 s … 2.020 s 10 runs
```
I dug a little into why it was so much slower under the builder and
the answer seems to be ~13k calls to deepcopy, but I haven't dug
deeper yet to figure out if there's a way to "transfer" to the builder
rather than making copies.
Also fix SlotOverall so that passing it equal height and width doesn't
error out and instead reduces to a Circle. (bug discovered while
writing the new test case).
Also added documentation for the new facility as well as a nascent
CONTRIBUTING.md to collect pointers to the tools used by developers of
this project.