Skip to content

Commit 87f613e

Browse files
committed
docs: record profiling results
1 parent 4a1399f commit 87f613e

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

‎PROFILING-RESULTS.md‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Adaptive Triangulation Profiling Results
2+
3+
Benchmark command used for every step:
4+
5+
```bash
6+
maturin develop --release 2>&1 | tail -1
7+
python -u -c "
8+
import time, numpy as np
9+
import adaptive_triangulation as at
10+
rng = np.random.default_rng(42)
11+
for dim, n in [(2, 1000), (2, 5000), (3, 500)]:
12+
pts = rng.random((n, dim))
13+
init = pts[:dim+1]; add = pts[dim+1:]
14+
times = []
15+
for _ in range(3):
16+
t0 = time.perf_counter()
17+
tr = at.Triangulation(init.tolist())
18+
for p in add:
19+
try: tr.add_point(tuple(p))
20+
except: pass
21+
times.append(time.perf_counter() - t0)
22+
print(f'{dim}D {n}: {min(times)*1000:.1f}ms')
23+
"
24+
```
25+
26+
Baseline before any optimization:
27+
28+
| Case | Time |
29+
| --- | ---: |
30+
| 2D 1000 | 73.9 ms |
31+
| 2D 5000 | 1165.3 ms |
32+
| 3D 500 | 402.8 ms |
33+
34+
## Accepted
35+
36+
### 1. `FxHashMap` / `FxHashSet`
37+
38+
| Case | Before | After | Delta |
39+
| --- | ---: | ---: | ---: |
40+
| 2D 1000 | 73.9 ms | 63.3 ms | 14.3% faster |
41+
| 2D 5000 | 1165.3 ms | 1111.5 ms | 4.6% faster |
42+
| 3D 500 | 402.8 ms | 343.6 ms | 14.7% faster |
43+
44+
Outcome: kept. Geometric-mean speedup across the three cases was 12.7%.
45+
46+
### 2. Simplex walking for point location
47+
48+
| Case | Before | After | Delta |
49+
| --- | ---: | ---: | ---: |
50+
| 2D 1000 | 63.3 ms | 39.0 ms | 38.4% faster |
51+
| 2D 5000 | 1111.5 ms | 279.2 ms | 74.9% faster |
52+
| 3D 500 | 343.6 ms | 132.3 ms | 61.5% faster |
53+
54+
Outcome: kept. Geometric-mean speedup across the three cases was 58.3%.
55+
56+
## Rejected
57+
58+
### 3. Reuse `bowyer_watson` BFS scratch buffers
59+
60+
| Case | Before | After | Delta |
61+
| --- | ---: | ---: | ---: |
62+
| 2D 1000 | 39.0 ms | 39.4 ms | 1.0% slower |
63+
| 2D 5000 | 279.2 ms | 262.6 ms | 5.9% faster |
64+
| 3D 500 | 132.3 ms | 124.9 ms | 5.6% faster |
65+
66+
Outcome: reverted. Improvement was below the 10% threshold.
67+
68+
### 4. Extra 2D/3D no-transform fast paths in `point_in_circumcircle` / `volume`
69+
70+
| Case | Before | After | Delta |
71+
| --- | ---: | ---: | ---: |
72+
| 2D 1000 | 39.0 ms | 57.6 ms | 47.7% slower |
73+
| 2D 5000 | 279.2 ms | 339.5 ms | 21.6% slower |
74+
| 3D 500 | 132.3 ms | 171.2 ms | 29.4% slower |
75+
76+
Outcome: reverted. This was a clear regression.
77+
78+
## Final state
79+
80+
Current branch state includes the two accepted optimizations only.
81+
82+
| Case | Baseline | Final | Total delta |
83+
| --- | ---: | ---: | ---: |
84+
| 2D 1000 | 73.9 ms | 39.0 ms | 47.2% faster |
85+
| 2D 5000 | 1165.3 ms | 279.2 ms | 76.0% faster |
86+
| 3D 500 | 402.8 ms | 132.3 ms | 67.2% faster |
87+
88+
The flat vertex-storage refactor was not kept because the remaining low-complexity experiments after the algorithmic win were already below threshold or regressive, and the branch goal was to avoid adding complexity for marginal gains.

0 commit comments

Comments
 (0)